Implement Managed Identities Flashcards

(19 cards)

1
Q

What are managed IDs?

A
  • Provide a auto managed ID in Entra for apps to use when connecting to resource that support entra auth
  • Apps can use managed IDs to obtain Entra tokens without having to manage any credentials
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are system assigned managed IDs (SMIs)?

A
  • Enabled directly on an azure service instance, created as part of that instance
  • creates an ID for the instance in entra tenant trusted by the subscription of the instance
  • credentials are then provisioned onto the instance
  • lifecycle is tied to the service instance that its enabled on
  • cant be shared, only tied to resource its assigned to
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are user managed IDs (UMIs)?

A
  • standalone resource
  • Azure created ID in entra tenant thats trusted by sub in use
  • ID that can be assigned to one or more service instances
  • seperate lifecycle from the resource to which its assigned
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What would a SMI be used?

A
  • Workloads contained within a single resource
  • Workloads needing independent Identities
  • E.g. app that runs on a single VM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When would a UMI be used?

A
  • Workloads that run on multiple resources and can share a single ID
  • Workloads needing preauth to secure resource as part of a provisioning flow
  • Workloads where resources are recycled frequently but perms should stay consistent
    e.g. a workload where multiple VMs ned to access the same resource
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do SMIs work with Azure VM?

A
  • ARM receives a request to enable the SMI on a VM
  • ARM creates service principal in Entra for the ID of the VM
  • ARM configures the ID on the VM by updating the Azure Instance Metadata service identity endpoint with the service principal client ID and cert
  • After the VM has an ID, use the service principal info to grant the VM access to the resource
  • Code thats running on VM can request a token from Azure Instance Metadata Service endpoint accessible only from within the VM
  • A call is made to Entra ID to request an access token by using Client ID and cert configured in step 3
  • Entra returns JWT access token
  • Code sends the token on a call to a service that supports entra
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do UMIs work with Azure VM?

A
  • ARM receives a request to create a UMI
  • ARM creates service principal in entra for UMI
  • ARM receives a request to configure the UMI on a VM and updates the Azure Instance Metadata service Identity endpoint with the UMI service principal client ID and cert
  • After UMI is created use the service principal info to grant the ID access to resources
  • Code thats running on VM can request a token from Azure Instance Metadata Service endpoint accessible only from within the VM
  • A call is made to Entra ID to request an access token by using Client ID and cert configured in step 3
  • Entra returns JWT access token
  • Code sends the token on a call to a service that supports entra
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What role is needed to create or enable a VM with an SMI?

A

VM Contributor role assignment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the command to enable an SMI during creation of VM?

A

az vm create –resource-group myRG –name myVm –image win2016datacenter –generate-ssh-keys –assign-identity - –role contributor –scope mySub –admin-user username –admin-password pward

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the command to enable SMI on an existing VM?

A

az vm identity assign -g myRG -n myVM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What roles are needed to assign a UMI to a VM during its creation?

A

VM contributor and Managed Identity Operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Command to create UMI?

A

az identity create -g myRG -n MyUMI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Command to assign UMI to VM?

A

az vm create –resource-group myRG –name myVm –image win2016datacenter –generate-ssh-keys –assign-identity MyUMI - –role contributor –scope mySub –admin-user username –admin-password pward

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Command to assign UMI to existing UMI?

A

az vm identity assign -g myRG -n myVM –identities MyUMI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is DefaultAzureCredentials?

A
  • Supported by Azure Identity Library
  • Ayto attempts to auth via multiple mechanisms
  • credential type can be used in dev env using your own credentials, it can also be used in your prod env using a managed ID with no code changes between envs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the order of auth methods used by DefaultAzureCredentials?

A
  • Env vars
  • Managed ID
  • Visual Studio (if dev is authenticated via VS)
  • Azure CLI (using az login command)
  • Azure PowerShell
  • Interactive Browser
17
Q

.NET Command to add the Azure identity SDK and code example of initialisation?

A
  • dotnet add package Azure.Identity
  • var client = new BlobClient(new Uri(<BLOB_URI>), new DefaultAzureCredential());</BLOB_URI>
18
Q

What options can we specify for default credentials?

A
  • var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = <user_assigned_client_id> });</user_assigned_client_id>
  • new BlobClient(new Uri<BLOB_URI>), credential)</BLOB_URI>
19
Q

What is ChainedTokenCredential?

A
  • More advanced users of Azure Identity may want to customise credentials considered when authenticating
  • ChainedTokenCredential enables users to combine multiple credential instances to define a customised chain
  • E.g. var credential = new ChainedTokenCredential(new ManagedIdentityCredential(), new AzureCliCredential()); attempts to auth using managed ID and falls back to CLI if managed ID not available in current env