Access the Azure Container Registry using Azure Managed Identity programatically

  1. Install the MSI to the VM

2. Get the ARM access token from the MSI endpoint

3. Get the refresh token from “https://$REGISTRY/oauth2/exchange” at first and then use the refresh token to get the access token for ACR

4. Login to ACR with the access token obtained. Please be advised the username is “00000000–0000–0000–0000–000000000000”

You could find more detail about login to ACR programatically in below

kubelet with cloud-provider as Azure also uses the similar approach

https://github.com/kubernetes/kubernetes/blob/master/pkg/credentialprovider/azure/azure_credentials.go#L185

--

--

Interested in CloudNative | CKA&Azure Associate Admin&ITIL | https://github.com/Shuanglu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store