Skip to content

Commit a169833

Browse files
Add custom service account support
1 parent ea0f90e commit a169833

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

articles/azure-app-configuration/reference-kubernetes-provider.md

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ The `spec.auth.workloadIdentity` property has the following child properties. On
5858
|---|---|---|---|
5959
|managedIdentityClientId|The client ID of the user-assigned managed identity associated with the workload identity.|alternative|string|
6060
|managedIdentityClientIdReference|The client ID of the user-assigned managed identity can be obtained from a ConfigMap. The ConfigMap must be in the same namespace as the Kubernetes provider.|alternative|object|
61+
|serviceAccountName|The name of the service account associated with the workload identity.|alternative|string|
6162

6263
The `spec.auth.workloadIdentity.managedIdentityClientIdReference` property has the following child properties.
6364

@@ -246,19 +247,40 @@ By default, autoscaling is disabled. However, if you have multiple `AzureAppConf
246247

247248
1. [Enable Workload Identity](/azure/aks/workload-identity-deploy-cluster#update-an-existing-aks-cluster) on the Azure Kubernetes Service (AKS) cluster.
248249

249-
1. [Get the OIDC issuer URL](/azure/aks/workload-identity-deploy-cluster#retrieve-the-oidc-issuer-url) of the AKS cluster.
250+
2. [Get the OIDC issuer URL](/azure/aks/workload-identity-deploy-cluster#retrieve-the-oidc-issuer-url) of the AKS cluster.
250251

251-
1. [Create a user-assigned managed identity](/azure/active-directory/managed-identities-azure-resources/how-manage-user-assigned-managed-identities#create-a-user-assigned-managed-identity) and note down its client ID after creation.
252+
3. [Create a user-assigned managed identity](/azure/active-directory/managed-identities-azure-resources/how-manage-user-assigned-managed-identities#create-a-user-assigned-managed-identity) and note down its client ID after creation.
253+
254+
4. [Grant the user-assigned managed identity **App Configuration Data Reader** role](/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vmss#user-assigned-managed-identity) in Azure App Configuration.
252255

253-
1. Create the federated identity credential between the managed identity, OIDC issuer, and subject using the Azure CLI.
256+
5. Create the federated identity credential between the managed identity, OIDC issuer, and subject using the Azure CLI. You can choose to bind the managed identity to the provider global service account or a custom service account.
254257

255-
``` azurecli
256-
az identity federated-credential create --name "${FEDERATED_IDENTITY_CREDENTIAL_NAME}" --identity-name "${USER_ASSIGNED_IDENTITY_NAME}" --resource-group "${RESOURCE_GROUP}" --issuer "${AKS_OIDC_ISSUER}" --subject system:serviceaccount:azappconfig-system:az-appconfig-k8s-provider --audience api://AzureADTokenExchange
257-
```
258+
##### [Use service account of provider](#tab/global)
258259

259-
1. [Grant the user-assigned managed identity **App Configuration Data Reader** role](/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vmss#user-assigned-managed-identity) in Azure App Configuration.
260+
``` azurecli
261+
az identity federated-credential create --name "${FEDERATED_IDENTITY_CREDENTIAL_NAME}" --identity-name "${USER_ASSIGNED_IDENTITY_NAME}" --resource-group "${RESOURCE_GROUP}" --issuer "${AKS_OIDC_ISSUER}" --subject system:serviceaccount:azappconfig-system:az-appconfig-k8s-provider --audience api://AzureADTokenExchange
262+
```
263+
264+
##### [Use custom service account](#tab/custom)
265+
266+
Create a custom service account in the same namespace as the `AzureAppConfigurationProvider` resource.
267+
268+
``` console
269+
kubectl create serviceaccount my-service-account -n default
270+
```
271+
272+
Create the federated identity credential to bind the managed identity to the custom service account.
260273

261-
1. Set the `spec.auth.workloadIdentity.managedIdentityClientId` property to the client ID of the user-assigned managed identity in the following sample `AzureAppConfigurationProvider` resource and deploy it to the AKS cluster.
274+
``` azurecli
275+
az identity federated-credential create --name "${FEDERATED_IDENTITY_CREDENTIAL_NAME}" --identity-name "${USER_ASSIGNED_IDENTITY_NAME}" --resource-group "${RESOURCE_GROUP}" --issuer "${AKS_OIDC_ISSUER}" --subject system:serviceaccount:default:my-service-account --audience api://AzureADTokenExchange
276+
277+
```
278+
279+
---
280+
281+
6. Apply the following sample `AzureAppConfigurationProvider` resource to the Kubernetes cluster.
282+
283+
##### [Use service account of provider](#tab/global)
262284

263285
``` yaml
264286
apiVersion: azconfig.io/v1
@@ -274,6 +296,24 @@ By default, autoscaling is disabled. However, if you have multiple `AzureAppConf
274296
managedIdentityClientId: <your-managed-identity-client-id>
275297
```
276298

299+
##### [Use custom service account](#tab/custom)
300+
301+
``` yaml
302+
apiVersion: azconfig.io/v1
303+
kind: AzureAppConfigurationProvider
304+
metadata:
305+
name: appconfigurationprovider-sample
306+
spec:
307+
endpoint: <your-app-configuration-store-endpoint>
308+
target:
309+
configMapName: configmap-created-by-appconfig-provider
310+
auth:
311+
workloadIdentity:
312+
serviceAccountName: my-service-account
313+
```
314+
315+
---
316+
277317
#### Use connection string
278318

279319
1. Create a Kubernetes Secret in the same namespace as the `AzureAppConfigurationProvider` resource and add Azure App Configuration connection string with key *azure_app_configuration_connection_string* in the Secret.

0 commit comments

Comments
 (0)