0
0
Azurecloud~10 mins

Managed identities concept 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 --name myVM --resource-group myResourceGroup --image UbuntuLTS --assign-identity [1]
Drag options to blanks, or click blank then click option'
Afalse
Bnone
Ctrue
Dauto
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables the identity, so no managed identity is assigned.
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'
A/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity
Btrue
Csystem
Dauto
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'true' or 'auto' instead of the resource ID.
Using 'system' which is not a valid identity identifier.
3fill in blank
hard

Fix the error in the code to retrieve an access token for a managed identity in Azure CLI.

Azure
az account get-access-token --resource [1]
Drag options to blanks, or click blank then click option'
Ahttps://management.azure.com/
Bhttps://graph.microsoft.com/
Chttps://identity.azure.net/
Dhttps://azure.com/
Attempts:
3 left
💡 Hint
Common Mistakes
Using Microsoft Graph URI when requesting tokens for Azure management.
Using invalid or incomplete URIs.
4fill in blank
hard

Fill both blanks to create a user-assigned managed identity and assign it to a VM.

Azure
az identity create --name [1] --resource-group myResourceGroup
az vm identity assign --resource-group myResourceGroup --name myVM --identities [2]
Drag options to blanks, or click blank then click option'
AmyUserIdentity
B/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myUserIdentity
CmyVMIdentity
D/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myVMIdentity
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for creation and assignment.
Using the VM name instead of the identity name.
5fill in blank
hard

Fill all three blanks to assign a system-assigned identity, grant it Reader role on a storage account, and retrieve its principal ID.

Azure
az vm identity assign --resource-group myResourceGroup --name myVM --identities [1]
az role assignment create --assignee [2] --role Reader --scope /subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount
az vm show --resource-group myResourceGroup --name myVM --query identity.principalId -o tsv
Drag options to blanks, or click blank then click option'
Atrue
B"$(az vm show --resource-group myResourceGroup --name myVM --query identity.principalId -o tsv)"
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables the identity.
Not using the principalId for role assignment.
Using inconsistent commands for principalId retrieval.