0
0
Azurecloud~10 mins

Managed identity integration in Azure - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign a system-assigned managed identity to an Azure VM.

Azure
az vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --assign-identity [1]
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnone
Dauto
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables the identity.
Using 'none' or 'auto' are invalid values for this flag.
2fill in blank
medium

Complete the code to assign a user-assigned managed identity to an Azure VM.

Azure
az vm identity assign --resource-group myResourceGroup --name myVM --identities [1]
Drag options to blanks, or click blank then click option'
Asystem
Btrue
C/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'true' or 'system' instead of the resource ID.
Providing only the identity name without full resource ID.
3fill in blank
hard

Fix the error in the code to enable managed identity on an Azure App Service.

Azure
az webapp identity assign --resource-group myResourceGroup --name myAppService --identities [1]
Drag options to blanks, or click blank then click option'
Atrue
Buser
Cnone
Dsystem
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'true' causes an error because it's not a valid identity value.
Using 'none' disables identity.
4fill in blank
hard

Fill both blanks to create a role assignment for a managed identity with Reader role on a resource group.

Azure
az role assignment create --assignee [1] --role [2] --scope /subscriptions/xxxx/resourceGroups/myResourceGroup
Drag options to blanks, or click blank then click option'
AmyManagedIdentityPrincipalId
BReader
CContributor
DmyResourceGroup
Attempts:
3 left
💡 Hint
Common Mistakes
Using resource group name as assignee.
Using 'Contributor' role instead of 'Reader' when only read access is needed.
5fill in blank
hard

Fill all three blanks to retrieve an access token for a managed identity and use it to call Azure REST API.

Azure
token=$(az account get-access-token --resource [1] --query accessToken -o tsv)
curl -H "Authorization: Bearer [2]" https://management.azure.com/[3]?api-version=2021-04-01
Drag options to blanks, or click blank then click option'
Ahttps://management.azure.com/
B$token
Csubscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM
Dhttps://graph.microsoft.com/
Attempts:
3 left
💡 Hint
Common Mistakes
Using Microsoft Graph URL as resource for token.
Not using the token variable in the curl command.
Incorrect API path.