Container Apps Pull Image using an Azure Service Principal
This post will go over how to use a service principal to pull an image to your Container App.
Overview
In most cases pulling using system or user managed identity is the recommended to authenicate with your ACR.
We suggest you follow the authenication method listed in the documentation below.
Azure Container Apps image pull from Azure Container Registry with managed identity
This blog details the scenario where you are required to use a service princial by your organization.
Create a service princial and assign it ACR Pull Cerdentials.
-
Please follow the instructions from the below documentation.
-
Please take notes of the following values, before proceeding to the next steps.
Azure Container Registry HostName
Example:
myazcrname.azurecr.ioService Prinical App ID
Example:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxService Prinical Secret
Example:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxImage Name and Tag
Example:
myimagename:latest
Configure the Container App to pull using the Service Principal.
-
Naviate to your container app, if you do not have an existing container app please go ahead and follow the below documentation in order to create one.
Quickstart: Deploy your first container app using the Azure portal
-
Naviate to the
Revisions and Replicasection, under theApplicationDrop Down menu. -
Select the
Create a new revisionoption. -
Click on the container image that needs to be updated.

-
Select the
Docker Hub or other registriesradio button. Then selectprivate.
-
In the
Registry login serverclickAdd new.
In the
Login serverfield enter your Azure Container Registry Host Name. đź”—In the
Registry user nameenter your Application ID of the service princial.đź”—In the
Registry password, enter your Service Principal Secret.đź”—Hit the
Addbutton. -
In the
Image and tagfield enter your image name and tag of the image you would like to pull from the contianer registry.đź”— -
Make sure to hit
Save, to change the container settings. Then hitCreatewhen you are ready to create the revision.