Skip to content

Commit 1b9fcc2

Browse files
authored
Merge pull request #231510 from ntrogh/als-attach-gallery
[Azure Lab Services] Attach compute gallery: include guest user prereqs
2 parents ca93b03 + a04a90f commit 1b9fcc2

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

articles/lab-services/how-to-attach-detach-shared-image-gallery.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This article shows how to attach or detach an Azure compute gallery to a lab pla
1919
> [!IMPORTANT]
2020
> To show a virtual machine image in the list of images during lab creation, you need to replicate the compute gallery image to the same region as the lab plan. You need to manually [replicate images](../virtual-machines/shared-image-galleries.md) to other regions in the compute gallery.
2121
22-
Saving images to a compute gallery and replicating those images incurs additional cost. This cost is separate from the Azure Lab Services usage cost. Learn more about [Azure Compute Gallery pricing](../virtual-machines/azure-compute-gallery.md#billing).
22+
Saving images to a compute gallery and replicating those images incurs extra cost. This cost is separate from the Azure Lab Services usage cost. Learn more about [Azure Compute Gallery pricing](../virtual-machines/azure-compute-gallery.md#billing).
2323

2424
## Prerequisites
2525

@@ -32,7 +32,9 @@ Saving images to a compute gallery and replicating those images incurs additiona
3232
| [Owner](/azure/role-based-access-control/built-in-roles#owner) | Azure compute gallery | If you attach an existing compute gallery. |
3333
| [Owner](/azure/role-based-access-control/built-in-roles#owner) | Resource group | If you create a new compute gallery. |
3434

35-
Learn how to [assign an Azure role in Azure role-based access control (Azure RBAC)](/azure/role-based-access-control/role-assignments-steps#step-5-assign-role).
35+
- If your Azure account is a guest user in Azure Active Directory, your Azure account needs to have the [Directory Readers](/azure/active-directory/roles/permissions-reference#directory-readers) role to attach an existing compute gallery.
36+
37+
Learn how to [assign an Azure role in Azure role-based access control (Azure RBAC)](/azure/role-based-access-control/role-assignments-steps#step-5-assign-role).
3638

3739
## Scenarios
3840

@@ -74,19 +76,20 @@ If you already have an Azure compute gallery, you can also attach it to your lab
7476

7577
### Configure compute gallery permissions
7678

77-
The Azure Lab Services service principal needs to have the Owner Azure RBAC role on the Azure compute gallery. There are two Azure Lab Services service principals:
79+
The Azure Lab Services service principal needs to have the [Owner](/azure/role-based-access-control/built-in-roles#owner) Azure RBAC role on the Azure compute gallery. There are two Azure Lab Services service principals:
7880

7981
| Name | Application ID | Description |
8082
| ---- | ----- | ---- |
8183
| Azure Lab Services | c7bb12bf-0b39-4f7f-9171-f418ff39b76a | Service principal for Azure Lab Services lab plans (V2). |
8284
| Azure Lab Services | 1a14be2a-e903-4cec-99cf-b2e209259a0f | Service principal for Azure Lab Services lab accounts (V1). |
8385

84-
To attach a compute gallery to a lab plan, assign the Owner role to the service principal with application ID `c7bb12bf-0b39-4f7f-9171-f418ff39b76a`.
86+
To attach a compute gallery to a lab plan, assign the [Owner](/azure/role-based-access-control/built-in-roles#owner) role to the service principal with application ID `c7bb12bf-0b39-4f7f-9171-f418ff39b76a`.
87+
88+
If your Azure account is a guest user, your Azure account needs to have the [Directory Readers](/azure/active-directory/roles/permissions-reference#directory-readers) role to perform the role assignment. Learn about [role assignments for guest users](/azure/role-based-access-control/role-assignments-external-users#guest-user-cannot-browse-users-groups-or-service-principals-to-assign-roles).
8589

86-
> [!NOTE]
87-
> When you add a role assignment in the Azure portal, the user interface shows the *object ID* of the service principal, which is different from the *application ID*. The object ID for a service principal can be different in each Azure subscription. You can find the service principal object ID in Azure Active Directory, based on its application ID. Learn more about [Service principal objects](/azure/active-directory/develop/app-objects-and-service-principals#service-principal-object).
90+
# [Azure CLI](#tab/azure-cli)
8891

89-
Follow these steps to grant permissions to the Azure Lab Service service principal by using the Azure CLI:
92+
Follow these steps to grant permissions to the Azure Lab Services service principal by using the Azure CLI:
9093

9194
1. Open [Azure Cloud Shell](https://shell.azure.com). Alternately, select the **Cloud Shell** button on the menu bar at the upper right in the [Azure portal](https://portal.azure.com).
9295

@@ -116,6 +119,32 @@ Follow these steps to grant permissions to the Azure Lab Service service princip
116119
117120
Replace the text placeholders *`<service-principal-object-id>`* and *`<gallery-id>`* with the outcomes of the previous commands.
118121
122+
# [Azure portal](#tab/portal)
123+
124+
When you add a role assignment in the Azure portal, the user interface shows the *object ID* of the service principal, which is different from the *application ID*. The object ID for a service principal is different in each Azure subscription. Learn more about [Service principal objects](/azure/active-directory/develop/app-objects-and-service-principals#service-principal-object).
125+
126+
Follow these steps to grant permissions to the Azure Lab Services service principal by using the Azure portal:
127+
128+
1. Sign in to the [Azure portal](https://portal.azure.com).
129+
1. In the search box at the top, enter *Enterprise applications*, and select **Enterprise applications** from the services list.
130+
1. On the **All applications** page, remove the **Application type** filter, and enter *c7bb12bf-0b39-4f7f-9171-f418ff39b76a* in the **Application ID starts with** filter.
131+
132+
:::image type="content" source="./media/how-to-attach-detach-shared-image-gallery/lab-services-enterprise-applications.png" alt-text="Screenshot that shows the list of enterprise applications in the Azure portal, highlighting the application ID filter." lightbox="./media/how-to-attach-detach-shared-image-gallery/lab-services-enterprise-applications.png":::
133+
134+
1. Note the **Object ID** value of the Azure Lab Services service principal.
135+
1. Go to your Azure compute gallery resource.
136+
1. Select **Access control (IAM)**, and then select **Add** > **Add role assignment**.
137+
1. On the **Role** page, select the **Owner** role from the list.
138+
1. On the **Members** page, select **Select members**.
139+
1. Enter *Azure Lab Services** in the search box, select both items, and then select **Select**.
140+
1. In the **Add role assignment** page, remove the item that doesn't match the object ID of the Azure Lab Services service principal.
141+
142+
:::image type="content" source="./media/how-to-attach-detach-shared-image-gallery/compute-gallery-add-role-assignment.png" alt-text="Screenshot that shows the add role assignment page for the compute gallery in the Azure portal." lightbox="./media/how-to-attach-detach-shared-image-gallery/compute-gallery-add-role-assignment.png":::
143+
144+
1. On the **Review + Assign** page, select **Review + assign** to add the role assignment to the compute gallery.
145+
146+
---
147+
119148
Learn more about how to [assign an Azure role in Azure role-based access control (Azure RBAC)](/azure/role-based-access-control/role-assignments-steps#step-5-assign-role).
120149
121150
### Attach the compute gallery
62.5 KB
Loading
83.1 KB
Loading

0 commit comments

Comments
 (0)