Using a user-managed identity for AKS clusters
When you are creating a Cloudera environment, you can specify a user-managed identity to be used for management of Azure resources.
- Configure encryption on the environment and specify a managed identity
- Configure a specific user managed identity for AKS clusters
Encryption Managed Identity
It is possible to configure a managed identity when setting up the encryption for the Cloudera environment. This managed identity is primarily used for the encryption of the Azure Database for PostgreSQL Flexible Server, but can also serve as the AKS managed identity.
For more information about the Azure Database for PostgreSQL Flexible Server, see the Encrypting VM disks with customer managed keys documentation.
Contributor
on the resource group the AKS cluster is being created inContributor
on the resource group containing the network to be usedManaged Identity Operator
on the resource group containing additional managed identities (logger identity and so on)
identity create
command in Azure CLI to create the managed
identity and the role assignment create
command to assign roles as shown in
the following
example:$ az identity create -n aks-identity-example -g test-resource-group -l westus2
{
"clientId": "25104331-3cdc-4a5e-9e8b-8afc066c9beb",
"id": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourcegroups/test-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks-identity-example",
"location": "westus2",
"name": "test-aks-identity-example",
"principalId": "25104331-3cdc-4a5e-9e8b-8afc066c9beb",
"resourceGroup": "<resource-group-name>",
"systemData": null,
"tags": {},
"tenantId": "49d9544f-09a2-4360-bfa7-7e08ad057157",
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Contributor" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/aks-resource-group"
{
"condition": null,
"conditionVersion": null,
"createdBy": null,
"createdOn": "2023-11-27T14:00:50.679610+00:00",
"delegatedManagedIdentityResourceId": null,
"description": null,
"id": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/test-resource-group/providers/Microsoft.Authorization/roleAssignments/aaa3bec0-bf57-4e09-8b85-8b1652f3647a",
"name": "aaa3bec0-bf57-4e09-8b85-8b1652f3647a",
"principalId": "25104331-3cdc-4a5e-9e8b-8afc066c9beb",
"principalType": "ServicePrincipal",
"resourceGroup": "test-resource-group",
"roleDefinitionId": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/providers/Microsoft.Authorization/roleDefinitions/098c7804-2b99-49bd-9dbd-eb188e4213c6",
"scope": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/aks-resource-group",
"type": "Microsoft.Authorization/roleAssignments",
"updatedBy": "bea2645f-78eb-4cc6-a269-f6108a74d48d",
"updatedOn": "2023-11-27T14:00:51.037481+00:00"
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Contributor" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/network-resource-group"
{
...
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Managed Identity Operator" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/managed-identity-resource-group"
{
...
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Key Vault Crypto Officer" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/managed-identity-resource-group/providers/Microsoft.KeyVault/vaults/key-vault"
{
...
}
AKS Specific Managed Identity
You can provide a specific managed identity that is only used for the AKS clusters.
Contributor
on the resource group the AKS cluster is being created inContributor
on the resource group containing the network to be usedManaged Identity Operator
on the resource group containing additional managed identities (logger identity etc.)
identity create
command in Azure CLI to create the managed
identity and the role assignment create
command to assign roles as shown in
the following
example:$ az identity create -n aks-identity-example -g test-resource-group -l westus2
{
"clientId": "25104331-3cdc-4a5e-9e8b-8afc066c9beb",
"id": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourcegroups/test-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks-identity-example",
"location": "westus2",
"name": "test-aks-identity-example",
"principalId": "25104331-3cdc-4a5e-9e8b-8afc066c9beb",
"resourceGroup": "<resource-group-name>",
"systemData": null,
"tags": {},
"tenantId": "49d9544f-09a2-4360-bfa7-7e08ad057157",
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Contributor" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/aks-resource-group"
{
"condition": null,
"conditionVersion": null,
"createdBy": null,
"createdOn": "2023-11-27T14:00:50.679610+00:00",
"delegatedManagedIdentityResourceId": null,
"description": null,
"id": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/test-resource-group/providers/Microsoft.Authorization/roleAssignments/aaa3bec0-bf57-4e09-8b85-8b1652f3647a",
"name": "aaa3bec0-bf57-4e09-8b85-8b1652f3647a",
"principalId": "25104331-3cdc-4a5e-9e8b-8afc066c9beb",
"principalType": "ServicePrincipal",
"resourceGroup": "test-resource-group",
"roleDefinitionId": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/providers/Microsoft.Authorization/roleDefinitions/098c7804-2b99-49bd-9dbd-eb188e4213c6",
"scope": "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/aks-resource-group",
"type": "Microsoft.Authorization/roleAssignments",
"updatedBy": "bea2645f-78eb-4cc6-a269-f6108a74d48d",
"updatedOn": "2023-11-27T14:00:51.037481+00:00"
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Contributor" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/network-resource-group"
{
...
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Managed Identity Operator" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/managed-identity-resource-group"
{
...
}
$ az role assignment create --assignee 25104331-3cdc-4a5e-9e8b-8afc066c9beb --role "Key Vault Crypto Officer" --scope "/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourceGroups/managed-identity-resource-group/providers/Microsoft.KeyVault/vaults/key-vault"
{
...
}
- If Key Vault is setup with RBAC permissions:
-
Key Vault Crypto Officer
on Key Vault containing CMK if using managed identities with encryption
-
- If Key Vault is setup with Access policies:
- Key Management Operations - ALL
- Cryptographic Operations - ALL
$ cdp environments create-azure-environment --environment-name "cert-env-example" --credential-name "cert-example" --data-services "azure={sharedManagedIdentity=/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourcegroups/test-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks-identity-example}"
$ cdp environments update-data-service-resources --environment "cert-env-example" --data-services "azure={sharedManagedIdentity=/subscriptions/43ba24ce-df3c-4308-901d-a7006e345e55/resourcegroups/test-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks-identity-example}"