Skip to content

Commit b0105f9

Browse files
committed
Add Powershell deployment command. Delete registry create/image push commands; link to existing content from prerequisites.
1 parent 3d80a4d commit b0105f9

File tree

1 file changed

+23
-49
lines changed

1 file changed

+23
-49
lines changed

articles/container-apps/managed-identity-image-pull.md

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ This article describes how to use a Bicep template to configure your container a
619619
- If you don't have one, you can [create one for free](https://azure.microsoft.com/free/).
620620
- If using Azure CLI, [install the Azure CLI](/cli/azure/install-azure-cli) on your local machine.
621621
- If using PowerShell, [install the Azure PowerShell](/powershell/azure/install-azure-powershell) on your local machine. Ensure that the latest version of the Az.App module is installed by running the command `Install-Module -Name Az.App`.
622+
- A private Azure Container Registry containing an image you want to pull. To create a container registry and push an image to it, see [Quickstart: Create a private container registry using the Azure CLI](/container-registry/container-registry-get-started-azure-cli.md) or [Quickstart: Create a private container registry using Azure PowerShell](/container-registry/container-registry-get-started-powershell.md)
622623

623624
[!INCLUDE [container-apps-create-cli-steps.md](../../includes/container-apps-create-cli-steps.md)]
624625

@@ -658,7 +659,6 @@ LOCATION="<LOCATION>"
658659
REGISTRY_NAME="<REGISTRY_NAME>"
659660
IMAGE_NAME="<IMAGE_NAME>"
660661
IMAGE_TAG="<IMAGE_TAG>"
661-
IMAGE_URL="<IMAGE_URL>"
662662
BICEP_TEMPLATE="<BICEP_TEMPLATE>"
663663
CONTAINERAPPS_ENVIRONMENT="<ENVIRONMENT_NAME>"
664664
CONTAINER_NAME="<CONTAINER_NAME>"
@@ -677,7 +677,6 @@ $Location = '<LOCATION>'
677677
$RegistryName = '<REGISTRY_NAME>'
678678
$ImageName = '<IMAGE_NAME>'
679679
$ImageTag = '<IMAGE_TAG>'
680-
$ImageUrl = '<IMAGE_URL>'
681680
$BicepTemplate = '<BICEP_TEMPLATE>'
682681
$ContainerAppsEnvironment = '<ENVIRONMENT_NAME>'
683682
$ContainerName = '<CONTAINER_NAME>'
@@ -692,49 +691,6 @@ $AcrPullDefinitionId = '7f951dda-4ed3-4680-a7ca-43fe172d538d'
692691

693692
The [`AcrPull`](/azure/role-based-access-control/built-in-roles#acrpull) role grants your user-assigned managed identity permission to pull the image from the registry.
694693

695-
### Create a container registry
696-
697-
If you don't already have a container registry, you can create it with the following command.
698-
699-
# [Azure CLI](#tab/azure-cli)
700-
701-
```azurecli
702-
az acr create \
703-
--name "$CONTAINER_REGISTRY_NAME" \
704-
--resource-group "$RESOURCE_GROUP" \
705-
--location "$LOCATION" \
706-
--sku Basic \
707-
--admin-enabled true
708-
```
709-
710-
# [Azure PowerShell](#tab/azure-powershell)
711-
712-
```azurepowershell
713-
TODO1
714-
```
715-
716-
---
717-
718-
### Push your image to the container registry
719-
720-
Push your image to the container registry with the following command.
721-
722-
# [Azure CLI](#tab/azure-cli)
723-
724-
```azurecli
725-
az acr build \
726-
--registry "$CONTAINER_REGISTRY_NAME" \
727-
--image "$CONTAINER_REGISTRY_IMAGE_NAME:$CONTAINER_REGISTRY_IMAGE_TAG" "$CONTAINER_REGISTRY_IMAGE_URL"
728-
```
729-
730-
# [Azure PowerShell](#tab/azure-powershell)
731-
732-
```azurepowershell
733-
TODO1
734-
```
735-
736-
---
737-
738694
## Bicep template
739695

740696
Copy the following Bicep template and save it as a file with the extension `.bicep`.
@@ -865,9 +821,9 @@ az deployment group create \
865821
logAnalyticsWorkspaceName="$LOG_ANALYTICS_WORKSPACE_NAME" \
866822
appInsightsName="$APP_INSIGHTS_NAME" \
867823
containerAppName="$CONTAINERAPP_NAME" \
868-
azureContainerRegistry="$CONTAINER_REGISTRY_NAME" \
869-
azureContainerRegistryImage="$CONTAINER_REGISTRY_IMAGE_NAME" \
870-
azureContainerRegistryImageTag="$CONTAINER_REGISTRY_IMAGE_TAG" \
824+
azureContainerRegistry="$REGISTRY_NAME" \
825+
azureContainerRegistryImage="$IMAGE_NAME" \
826+
azureContainerRegistryImageTag="$IMAGE_TAG" \
871827
azureContainerName="$CONTAINER_NAME" \
872828
acrPullDefinitionId="$ACR_PULL_DEFINITION_ID" \
873829
userAssignedIdentityName="$USER_ASSIGNED_IDENTITY_NAME" \
@@ -877,7 +833,25 @@ az deployment group create \
877833
# [Azure PowerShell](#tab/azure-powershell)
878834

879835
```azurepowershell
880-
TODO1
836+
$params = @{
837+
environmentName = $ContainerAppsEnvironment
838+
logAnalyticsWorkspaceName = $LogAnalyticsWorkspaceName
839+
appInsightsName = $AppInsightsName
840+
containerAppName = $ContainerAppName
841+
azureContainerRegistry = $RegistryName
842+
azureContainerRegistryImage = $ImageName
843+
azureContainerRegistryImageTag = $ImageTag
844+
azureContainerName = $ContainerName
845+
acrPullDefinitionId = $AcrPullDefinitionId
846+
userAssignedIdentityName = $UserAssignedIdentityName
847+
location = $Location
848+
}
849+
850+
New-AzResourceGroupDeployment `
851+
-ResourceGroupName $ResourceGroupName `
852+
-TemplateParameterObject $params `
853+
-TemplateFile $BicepTemplate `
854+
-SkipTemplateParameterPrompt
881855
```
882856

883857
---

0 commit comments

Comments
 (0)