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: learn-pr/azure/authenticate-azure-deployment-pipeline-service-principals/includes/5-grant-service-principal-access-azure.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ After Microsoft Entra ID has authenticated a service principal, the next questio
13
13
14
14
## Select the right role assignment for your pipeline
15
15
16
-
A role assignment has three key parts: who the role is assigned to (the *assignee*), what they can do (the *role*), and what resource or resources the role assignment applies to (the *scope*).
16
+
A role assignment has three key parts: who the role is assigned to (the _assignee_), what they can do (the _role_), and what resource or resources the role assignment applies to (the _scope_).
17
17
18
18
### Assignee
19
19
@@ -23,9 +23,9 @@ When you work with a service principal, you assign roles for that service princi
23
23
24
24
It can be a little more work to figure out which role to assign. In Azure, there are a few common roles:
25
25
26
-
-*Reader*, which allows the assignee to read information about resources but not modify or delete them.
27
-
-*Contributor*, which allows the assignee to create resources, and to read and modify existing resources. However, contributors can't grant other principals access to resources.
28
-
-*Owner*, which allows full control over resources, including granting other principals access.
26
+
-_Reader_, which allows the assignee to read information about resources but not modify or delete them.
27
+
-_Contributor_, which allows the assignee to create resources and to read and modify existing resources. However, contributors can't grant other principals access to resources.
28
+
-_Owner_, which allows full control over resources, including granting other principals access.
29
29
30
30
> [!CAUTION]
31
31
> You should only grant service principals the minimum permissions that they need to do their jobs. Most of the time, the Owner role is too permissive for a deployment pipeline.
@@ -50,12 +50,12 @@ Remember that role assignments are inherited. If you assign a role at a subscrip
50
50
Now that you understand the components of a role assignment, you can decide the appropriate values for your scenarios. Here are some general guidelines to consider:
51
51
52
52
> [!div class="checklist"]
53
-
> * Use the least permissive role that you can. If your pipeline is only going to deploy basic Bicep templates and won't manage role assignments, don't use the Owner role.
54
-
> * Use the narrowest scope that you can. Most pipelines only need to deploy resources to a resource group, so they shouldn't be given subscription-scoped role assignments.
55
-
> * For many pipelines, a good default option for a role assignment is the Contributor role on the resource group scope.
56
-
> * Consider everything your pipeline does, and everything it might do in the future. For example, you might consider creating a custom role definition for your website's deployment pipeline and only grant permissions for App Service and Application Insights. Next month, you might need to add an Azure Cosmos DB account to your Bicep file, but the custom role will block Azure Cosmos DB resources from being created.
53
+
> - Use the least permissive role that you can. If your pipeline is only going to deploy basic Bicep templates and won't manage role assignments, don't use the Owner role.
54
+
> - Use the narrowest scope that you can. Most pipelines only need to deploy resources to a resource group, so they shouldn't be given subscription-scoped role assignments.
55
+
> - For many pipelines, a good default option for a role assignment is the Contributor role on the resource group scope.
56
+
> - Consider everything your pipeline does, and everything it might do in the future. For example, you might consider creating a custom role definition for your website's deployment pipeline and only grant permissions for App Service and Application Insights. Next month, you might need to add an Azure Cosmos DB account to your Bicep file, but the custom role will block Azure Cosmos DB resources from being created.
57
57
Instead, it's often better to use a built-in role, or a combination of built-in roles, to avoid having to repeatedly change your role definitions. Consider using Azure Policy to enforce your governance requirements for allowed services, SKUs, and locations.
58
-
> * Test the pipeline to verify that the role assignment works.
58
+
> - Test the pipeline to verify that the role assignment works.
59
59
60
60
### Mixing and matching role assignments
61
61
@@ -113,7 +113,7 @@ Let's look at each argument:
113
113
114
114
> [!TIP]
115
115
> It's a good practice to provide a justification for your role assignments by specifying a description. A description helps anyone who reviews the role assignments later to understand their purpose, and to understand how you decided on the assignee, role, and scope.
116
-
116
+
>
117
117
> [!NOTE]
118
118
> Role assignments can take a few minutes to become active.
Copy file name to clipboardExpand all lines: learn-pr/azure/authenticate-azure-deployment-pipeline-service-principals/includes/6-exercise-authorize-service-principal-deployments.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ In the previous exercise, you signed in by using the service principal and then
16
16
17
17
::: zone pivot="cli"
18
18
19
-
1. In Visual Studio Code's Azure Cloud Shell (bash) terminal, sign in to Azure by running the following command:
19
+
1. In Visual Studio Code's Azure Cloud Shell (bash) terminal, sign in to Azure by running the following command:
20
20
21
21
```azurecli
22
22
az login
@@ -70,9 +70,9 @@ Now you'll create a resource group to contain the toy company's website resource
70
70
71
71
For your website's deployment pipeline, you decide to create a role assignment with the following details:
72
72
73
-
-**Assignee**: The service principal that you created in the previous exercise.
74
-
-**Role**: The Contributor built-in role.
75
-
-**Scope**: The resource group that you created in the previous step.
73
+
***Assignee**: The service principal that you created in the previous exercise.
74
+
***Role**: The Contributor built-in role.
75
+
***Scope**: The resource group that you created in the previous step.
76
76
77
77
::: zone pivot="cli"
78
78
@@ -116,7 +116,7 @@ You previously created a Bicep file that deploys your website's resources. Here,
116
116
117
117
## Deploy the Bicep file by using the service principal
118
118
119
-
You don't currently have a deployment pipeline, so you'll simulate what a pipeline does to deploy your Bicep file.
119
+
You don't currently have a deployment pipeline, so you'll simulate what a pipeline does to deploy your Bicep file.
120
120
121
121
::: zone pivot="cli"
122
122
@@ -183,8 +183,8 @@ Use the Azure portal to inspect the resources that you deployed and to inspect t
183
183
184
184
You might also see a deployment named **Failure-Anomalies-Alert-Rule-Deployment**. Application Insights creates this deployment automatically.
185
185
186
-
1. Select the **main** deployment to see what resources were deployed, and then expand **Deployment details**.
187
-
186
+
1. Select the **main** deployment to see what resources were deployed, and then expand **Deployment details**.
187
+
188
188
In this case, the App Service plan, the app, and the Application Insights instance are listed.
189
189
190
190
:::image type="content" source="../media/6-deployment-details.png" alt-text="Screenshot of the Azure portal deployments overview pane for the main deployment, with an App Service plan and app, and an Application Insights instance listed." border="true":::
@@ -193,7 +193,7 @@ Use the Azure portal to inspect the resources that you deployed and to inspect t
193
193
194
194
## Clean up the resource group and service principal
195
195
196
-
You've successfully created a service principal and role assignment, and you've deployed your website's resources by using a Bicep file. You can now remove the resources that you created.
196
+
You've successfully created a service principal and role assignment, and you've deployed your website's resources by using a Bicep file. You can now remove the resources that you created.
197
197
198
198
::: zone pivot="cli"
199
199
@@ -203,7 +203,7 @@ You've successfully created a service principal and role assignment, and you've
203
203
az logout
204
204
```
205
205
206
-
1. Sign back in to Azure with your own user account by running the following command:
206
+
1. Sign back in to Azure with your own user account by running the following command:
207
207
208
208
```azurecli
209
209
az login
@@ -219,7 +219,7 @@ You've successfully created a service principal and role assignment, and you've
219
219
220
220
When you're prompted to confirm, enter `y`.
221
221
222
-
2. Run the following command to delete the service principal. Replace the `APPLICATION_ID` placeholder with the application ID that you copied in the previous exercise:
222
+
1. Run the following command to delete the service principal. Replace the `APPLICATION_ID` placeholder with the application ID that you copied in the previous exercise:
223
223
224
224
```azurecli
225
225
az ad sp delete --id APPLICATION_ID
@@ -235,7 +235,7 @@ You've successfully created a service principal and role assignment, and you've
235
235
Logout-AzAccount
236
236
```
237
237
238
-
1. Sign back in to Azure with your own user account by running the following command:
238
+
1. Sign back in to Azure with your own user account by running the following command:
239
239
240
240
```azurepowershell
241
241
Connect-AzAccount
@@ -259,4 +259,4 @@ You've successfully created a service principal and role assignment, and you've
0 commit comments