Skip to content

Commit bb7aa14

Browse files
committed
Add docs on managed identity for Azure Blob
Signed-off-by: Somtochi Onyekwere <[email protected]>
1 parent c10c031 commit bb7aa14

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

docs/spec/v1beta2/buckets.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,78 @@ data:
432432
accountKey: <BASE64>
433433
```
434434

435+
#### Managed Identity with AAD Pod Identity
436+
437+
If you are using [aad pod identity](https://azure.github.io/aad-pod-identity/docs), you can create an identity that has access to Azure Storage.
438+
439+
```sh
440+
export IDENTITY_NAME="blob-access"
441+
442+
az role assignment create --role "Storage Blob Data Contributor" \
443+
--assignee-object-id "$(az identity show -n blob-access -o tsv --query principalId -g $RESOURCE_GROUP)" \
444+
--scope "/subscriptions/<SUBSCRIPTION-ID>/resourceGroups/aks-somto/providers/Microsoft.Storage/storageAccounts/<account-name>/blobServices/default/containers/<container-name>"
445+
446+
export IDENTITY_CLIENT_ID="$(az identity show -n ${IDENTITY_NAME} -g ${RESOURCE_GROUP} -otsv --query clientId)"
447+
export IDENTITY_RESOURCE_ID="$(az identity show -n ${IDENTITY_NAME} -otsv --query id)"
448+
```
449+
450+
Create an `AzureIdentity` object that references the identity created above:
451+
452+
```yaml
453+
---
454+
apiVersion: aadpodidentity.k8s.io/v1
455+
kind: AzureIdentity
456+
metadata:
457+
name: # source-controller label will match this name
458+
namespace: flux-system
459+
spec:
460+
clientID: <IDENTITY_CLIENT_ID>
461+
resourceID: <IDENTITY_RESOURCE_ID>
462+
type: 0 # user-managed identity
463+
```
464+
465+
Create an `AzureIdentityBinding` object that binds pods with a specific selector with the `AzureIdentity` created:
466+
467+
```yaml
468+
apiVersion: "aadpodidentity.k8s.io/v1"
469+
kind: AzureIdentityBinding
470+
metadata:
471+
name: ${IDENTITY_NAME}-binding
472+
spec:
473+
azureIdentity: ${IDENTITY_NAME}
474+
selector: ${IDENTITY_NAME}
475+
```
476+
477+
Label the source-controller correctly so that it can match an identity binding:
478+
479+
```yaml
480+
apiVersion: apps/v1
481+
kind: Deployment
482+
metadata:
483+
name: kustomize-controller
484+
namespace: flux-system
485+
spec:
486+
template:
487+
metadata:
488+
labels:
489+
aadpodidbinding: ${IDENTITY_NAME} # match the AzureIdentity name
490+
```
491+
492+
If you have set aad-pod-identity up correctly and labeled the source-controller pod, then you don't need to reference a secret.
493+
494+
```yaml
495+
apiVersion: source.toolkit.fluxcd.io/v1beta2
496+
kind: Bucket
497+
metadata:
498+
name: azure-bucket
499+
namespace: flux-system
500+
spec:
501+
interval: 5m0s
502+
provider: azure
503+
bucketName: testsas
504+
endpoint: https://testfluxsas.blob.core.windows.net
505+
```
506+
435507
#### GCP
436508

437509
When a Bucket's `.spec.provider` is set to `gcp`, the source-controller will

0 commit comments

Comments
 (0)