You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,10 +26,10 @@ This repo contains a few [PowerShell](https://github.com/PowerShell/PowerShell)
26
26
27
27
## Azure DevOps
28
28
29
+
- Manage Azure Service Connection with [Terraform](terraform/azure-devops/create-service-connection/README.md) to create Managed Identity, Federated Identity Credential, secret rotation and ITSM metadata
29
30
- Configure Terraform [azuread](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs#authenticating-to-azure-active-directory)/[azurerm](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#authenticating-to-azure) provider `ARM_*` environment variables to use the [AzureCLI](https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/azure-cli-v2?view=azure-pipelines) task [Service Connection](https://learn.microsoft.com/azure/devops/pipelines/library/connect-to-azure?view=azure-devops):
- Create Managed Identity for Service Connection with Workload identity federation: [create_azurerm_msi_oidc_service_connection.ps1](scripts/azure-devops/create_azurerm_msi_oidc_service_connection.ps1)
32
-
- Create Managed Identity for Service Connection with Workload identity federation with [Terraform](terraform/azure-devops/create-service-connection/README.md)
33
33
- List identities for Azure DevOps Service Connections in Entra ID pertaining to Azure DevOps organization and (optionally) project: [list_service_connection_identities.ps1](scripts/azure-devops/list_service_connection_identities.ps1)
34
34
- List Azure DevOps Service Connections in an Azure DevOps organization and project: [list_service_connections.ps1](scripts/azure-devops/list_service_connections.ps1)
35
35
- 'Pretty-name' Entra ID applications created for Service Connections, so the Service Connection name is included in the application display name: [rename_service_connection_applications.ps1](scripts/azure-devops/rename_service_connection_applications.ps1)
Many large customers have additional requirements around the management of the Entra ID object that a service connection creates and the permissions it is assigned to.
6
+
Azure DevOps uses service connections to connect to services that are targets for cloud infrastructure provisioning and application deployment. The most commonly used service connection is the [Azure Resource Manager service connection](https://learn.microsoft.com/azure/devops/pipelines/library/connect-to-azure?view=azure-devops). This creates an object in Azure DevOps, an identity in Entra ID and a role assignment in Azure.
7
7
8
-
These are a few common requirements and constraints:
8
+
Many Enterprise customers have requirements around the management of Entra [workload identities](https://learn.microsoft.com/entra/workload-id/workload-identities-overview) (applications, service principals, managed identities) as well as the permissions they are assigned to.
9
9
10
+
Here are a few common requirements and constraints:
11
+
12
+
- Creation of app registrations is [disabled in the Entra ID tenant](https://learn.microsoft.com/entra/identity/role-based-access-control/delegate-app-roles#restrict-who-can-create-applications) and/or
13
+
the use of Managed Identities for Azure access is mandated
10
14
- Specific secret expiration and auto-rotation control
11
-
-Custom role assignments for Azure [data plane](https://learn.microsoft.com/azure/azure-resource-manager/management/control-plane-and-data-plane#data-plane) access e.g. [Key Vault](https://learn.microsoft.com/azure/key-vault/general/rbac-guide?tabs=azure-cli#azure-built-in-roles-for-key-vault-data-plane-operations), [Kusto](https://learn.microsoft.com/azure/data-explorer/kusto/access-control/role-based-access-control), [Storage](https://learn.microsoft.com/azure/storage/blobs/assign-azure-role-data-access?tabs=portal)
12
-
-Creation of app registrations is [disabled in Entra ID](https://learn.microsoft.com/entra/identity/role-based-access-control/delegate-app-roles#restrict-who-can-create-applications) or the use of Managed Identities for Azure access is explicitly mandated
13
-
-Required ITSM metadata on Entra ID app registration (IT Service Management Reference, naming convention, notes)
14
-
-Co-owners are required to exist for Entra ID app registrations
15
-
-The organization has an IT fulfillment process where identities are automatically created based on a service request
15
+
-ITSM metadata is required on Entra ID objects (service nanagement reference, naming convention, notes)
16
+
-Co-owners are required to exist for Entra ID apps
17
+
-Custom role assignments are needed for Azure [data plane](https://learn.microsoft.com/azure/azure-resource-manager/management/control-plane-and-data-plane#data-plane) access e.g. [Key Vault](https://learn.microsoft.com/azure/key-vault/general/rbac-guide?tabs=azure-cli#azure-built-in-roles-for-key-vault-data-plane-operations), [Kusto](https://learn.microsoft.com/azure/data-explorer/kusto/access-control/role-based-access-control), [Storage](https://learn.microsoft.com/azure/storage/blobs/assign-azure-role-data-access?tabs=portal)
18
+
-Access needs to be granted to multiple Azure subscriptions that are not part of the same management group
19
+
-An IT fulfillment process exists where identities are automatically provisioned based on a service request
16
20
17
21
## Why Terraform?
18
22
19
-
Terraform employs a provider model which enable all changes to be made by a single tool and configuration:
23
+
Terraform employs a provider model which enables all changes to be made by a single tool and configuration:
| Entra ID |[azuread](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs)|[Microsoft Graph API](https://learn.microsoft.com/graph/use-the-api)|
26
30
27
-
Terraform is a declarative tool that is capable if inferring dependencies to create resources in the correct order. This is the output from `terraform graph`:
31
+
[HCL](https://developer.hashicorp.com/terraform/language#about-the-terraform-language), the language used, is declarative and the tool is capable if inferring dependencies to create resources in order. This is the output from `terraform graph`:
28
32

29
33
30
34
More information:
31
35
32
36
-[Overview of Terraform on Azure - What is Terraform?](https://learn.microsoft.com/azure/developer/terraform/overview)
Provisioning is a matter of specifying [variables](https://developer.hashicorp.com/terraform/language/values/variables) (see [inputs](#input_azdo_organization_url) below) and running `terraform apply`. To understand how the Terraform configuration can be created in automation, review
41
+
Provisioning is a matter of specifying Terraform [variables](https://developer.hashicorp.com/terraform/language/values/variables) (see [inputs](#inputs) below) and running `terraform apply`. To understand how the Terraform configuration can be created in automation, review
38
42
[tf_create_azurerm_service_connection.ps1](../../../scripts/azure-devops/tf_create_azurerm_service_connection.ps1) and the
39
43
[CI pipeline](azure-pipelines.yml).
40
44
41
45
### Examples
42
46
43
47
Terraform variable can be provided as a .auto.tfvars file, see [sample](config.auto.tfvars.sample).
44
48
45
-
#### App registration with Federated Credential and ITSM data
49
+
#### Default configuration
50
+
51
+
This creates an App registration with Federated Identity Credential and `Contributor` role on the Azure subscription used by the Terraform `azurerm` provider.
- Creation of app registrations is not [disabled in Entra ID](https://learn.microsoft.com/entra/identity/role-based-access-control/delegate-app-roles#restrict-who-can-create-applications);
62
+
or
63
+
- The user is member of a privileged Entra ID role e.g. [Application Developer](https://learn.microsoft.com/entra/identity/role-based-access-control/permissions-reference#application-developer)
64
+
- The user is an owner of the Azure subscription (so role assignment can be performed)
65
+
66
+
#### Managed Identity with FIC and custom RBAC
67
+
68
+
This creates a Managed Identity with Federated Identity Credential and custom Azure RBAC (role-based access control) role assignments:
- Creation of app registrations is not [disabled in Entra ID](https://learn.microsoft.com/entra/identity/role-based-access-control/delegate-app-roles#restrict-who-can-create-applications);
117
+
or
118
+
- The user is member of a privileged Entra ID role e.g. [Application Developer](https://learn.microsoft.com/entra/identity/role-based-access-control/permissions-reference#application-developer)
119
+
- The user is an owner of the Azure subscription (so role assignment can be performed)
120
+
121
+
#### App registration with short-lived secret and constrained RBAC
122
+
123
+
This creates an Entra ID app registration with secret that expires after 1 hour:
- Creation of app registrations is not [disabled in Entra ID](https://learn.microsoft.com/entra/identity/role-based-access-control/delegate-app-roles#restrict-who-can-create-applications);
143
+
or
144
+
- The user is member of a privileged Entra ID role e.g. [Application Developer](https://learn.microsoft.com/entra/identity/role-based-access-control/permissions-reference#application-developer)
145
+
- The user is an owner of the Azure resource group (so role assignment can be performed)
105
146
106
147
## Terraform Configuration
107
148
149
+
The (required) variables and output are listed below. Sensitive outputs are masked by default.
108
150
Generated with [terraform-docs](https://terraform-docs.io/).
109
151
110
152
### Providers
@@ -134,7 +176,7 @@ Generated with [terraform-docs](https://terraform-docs.io/).
134
176
| <aname="input_azdo_creates_identity"></a> [azdo_creates_identity](#input_azdo_creates_identity)| Let Azure DevOps create identity for service connection |`bool`|`false`| no |
135
177
| <aname="input_azure_role_assignments"></a> [azure_role_assignments](#input_azure_role_assignments)| Role assignments to create for the service connection's identity. If this is empty, the Contributor role will be assigned on the azurerm provider subscription. |`set(object({scope=string, role=string}))`|`[]`| no |
136
178
| <aname="input_create_federation"></a> [create_federation](#input_create_federation)| Use workload identity federation instead of a App Registration secret |`bool`|`true`| no |
137
-
| <aname="input_create_managed_identity"></a> [create_managed_identity](#input_create_managed_identity)| Creates a Managed Identity instead of a App Registration |`bool`|`true`| no |
179
+
| <aname="input_create_managed_identity"></a> [create_managed_identity](#input_create_managed_identity)| Creates a Managed Identity instead of a App Registration |`bool`|`false`| no |
138
180
| <aname="input_entra_app_notes"></a> [entra_app_notes](#input_entra_app_notes)| Description to put in the Entra ID app registration notes field |`string`|`null`| no |
139
181
| <aname="input_entra_app_owner_object_ids"></a> [entra_app_owner_object_ids](#input_entra_app_owner_object_ids)| Object ids of the users that will be co-owners of the Entra ID app registration |`list(string)`|`null`| no |
140
182
| <aname="input_entra_secret_expiration_days"></a> [entra_secret_expiration_days](#input_entra_secret_expiration_days)| Secret expiration in days |`number`|`90`| no |
0 commit comments