Skip to content

Commit 5a17f80

Browse files
committed
Edits per craigshoemaker review 20240916.
1 parent d37fc2b commit 5a17f80

File tree

2 files changed

+78
-67
lines changed

2 files changed

+78
-67
lines changed

articles/container-apps/get-started-existing-container-image.md

Lines changed: 77 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ Now that you have an environment created, you can deploy your first container ap
4343

4444
1. Set the environment variables.
4545

46-
Replace the \<PLACEHOLDERS\> with your values. Your user principal name will typically be in the format of an email address (for example, `[email protected]`).
46+
Replace the `<PLACEHOLDERS>` with your values. Your user principal name will typically be in the format of an email address (for example, `[email protected]`).
4747

4848
# [Bash](#tab/bash)
4949

5050
```bash
51-
KEY_VAULT_NAME=<KEY_VAULT_NAME>
51+
CONTAINER_APP_NAME=my-container-app
52+
KEY_VAULT_NAME=my-key-vault
5253
USER_PRINCIPAL_NAME=<USER_PRINCIPAL_NAME>
53-
SECRET_NAME=<SECRET_NAME>
54+
SECRET_NAME=my-secret-name
5455
CONTAINER_IMAGE_NAME=<CONTAINER_IMAGE_NAME>
5556
REGISTRY_SERVER=<REGISTRY_SERVER>
5657
REGISTRY_USERNAME=<REGISTRY_USERNAME>
@@ -59,9 +60,10 @@ Now that you have an environment created, you can deploy your first container ap
5960
# [Azure PowerShell](#tab/azure-powershell)
6061

6162
```azurepowershell-interactive
62-
$KeyVaultName = "<KEY_VAULT_NAME>"
63+
$ContainerAppName = "my-container-app"
64+
$KeyVaultName = "my-key-vault"
6365
$UserPrincipalName = "<USER_PRINCIPAL_NAME>"
64-
$SecretName = "<SECRET_NAME>"
66+
$SecretName = "my-secret-name"
6567
$ContainerImageName = "<CONTAINER_IMAGE_NAME>"
6668
$RegistryServer = "<REGISTRY_SERVER>"
6769
$RegistryUsername = "<REGISTRY_USERNAME>"
@@ -113,14 +115,10 @@ Now that you have an environment created, you can deploy your first container ap
113115

114116
1. Store your container registry password in the key vault.
115117

116-
Replace the \<PLACEHOLDERS\> with your values.
117-
118-
TODO1 I'm deliberately not using an env var to store the registry password here. You can delete this line with a suggestion.
118+
Replace `<REGISTRY_PASSWORD>` with your value.
119119

120120
# [Bash](#tab/bash)
121121

122-
TODO1 Per Copilot there does not seem to be an Azure CLI equivalent for ConvertTo-SecureString (except using Key Vault itself). You can delete this line with a suggestion.
123-
124122
```bash
125123
az keyvault secret set --vault-name $KEY_VAULT_NAME --name $SECRET_NAME --value "<REGISTRY_PASSWORD>"
126124
```
@@ -142,41 +140,22 @@ Now that you have an environment created, you can deploy your first container ap
142140
REGISTRY_PASSWORD=$(az keyvault secret show --name $SECRET_NAME --vault-name $KEY_VAULT_NAME --query value --output tsv)
143141
```
144142

145-
For more information, see
146-
- [Quickstart: Set and retrieve a secret from Azure Key Vault using Azure CLI](/azure/key-vault/secrets/quick-create-cli)
147-
- [Manage Key Vault using the Azure CLI](/azure/key-vault/general/manage-with-cli2)
148-
149143
# [Azure PowerShell](#tab/azure-powershell)
150144

151145
```azurepowershell-interactive
152146
$RegistryPassword = Get-AzKeyVaultSecret -VaultName "$KeyVaultName" -Name "$SecretName" -AsPlainText
153147
```
154148

155-
For more information, see
156-
- [Quickstart: Set and retrieve a secret from Azure Key Vault using PowerShell](/azure/key-vault/secrets/quick-create-powershell)
157-
- [Use Azure Key Vault in automation](/powershell/utility-modules/secretmanagement/how-to/using-azure-keyvault)
158-
159149
---
160150

161-
1. With the `containerapp create` command, deploy a container image to Azure Container Apps.
162-
163-
The example shown in this article demonstrates how to use a custom container image with common commands. Your container image might need more parameters for the following items:
164-
165-
- Set the revision mode
166-
- Define secrets
167-
- Define environment variables
168-
- Set container CPU or memory requirements
169-
- Enable and configure Dapr
170-
- Enable external or internal ingress
171-
- Provide minimum and maximum replica values or scale rules
151+
1. Deploy a container image to Azure Container Apps.
172152

173153
# [Bash](#tab/bash)
174154

175-
For details on how to provide values for any of these parameters to the `create` command, run `az containerapp create --help` or [visit the online reference](/cli/azure/containerapp#az-containerapp-create). To generate credentials for an Azure Container Registry, use [az acr credential show](/cli/azure/acr/credential#az-acr-credential-show).
176-
177155
```azurecli-interactive
178156
az containerapp create \
179-
--name my-container-app \
157+
--name $CONTAINER_APP_NAME \
158+
--location $LOCATION \
180159
--resource-group $RESOURCE_GROUP \
181160
--image $CONTAINER_IMAGE_NAME \
182161
--environment $CONTAINERAPPS_ENVIRONMENT \
@@ -185,33 +164,47 @@ Now that you have an environment created, you can deploy your first container ap
185164
--registry-password $REGISTRY_PASSWORD
186165
```
187166

167+
If you have enabled ingress on your container app, you can add `--query properties.configuration.ingress.fqdn` to the `create` command to return the public URL for the application.
168+
188169
# [Azure PowerShell](#tab/azure-powershell)
189170

190171
```azurepowershell-interactive
191172
$EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $ResourceGroupName -EnvName $ContainerAppsEnvironment).Id
173+
```
192174

193-
$TemplateObj = New-AzContainerAppTemplateObject -Name my-container-app -Image $ContainerImageName
175+
```azurepowershell-interactive
176+
$TemplateObj = New-AzContainerAppTemplateObject -Name $ContainerAppName -Image $ContainerImageName
177+
```
194178

195-
$RegistrySecretObj = New-AzContainerAppSecretObject -Name registry-secret -Value $RegistryPassword
179+
```azurepowershell-interactive
180+
$RegistrySecretObj = New-AzContainerAppSecretObject -Name $SecretName -Value $RegistryPassword
181+
```
196182

183+
```azurepowershell-interactive
197184
$RegistryArgs = @{
198-
PasswordSecretRef = 'registry-secret'
185+
PasswordSecretRef = $SecretName
199186
Server = $RegistryServer
200187
Username = $RegistryUsername
201188
}
189+
```
202190

191+
```azurepowershell-interactive
203192
$RegistryObj = New-AzContainerAppRegistryCredentialObject @RegistryArgs
193+
```
204194

195+
```azurepowershell-interactive
205196
$ContainerAppArgs = @{
206-
Name = 'my-container-app'
197+
Name = $ContainerAppName
207198
Location = $Location
208199
ResourceGroupName = $ResourceGroupName
209200
ManagedEnvironmentId = $EnvId
210201
TemplateContainer = $TemplateObj
211202
ConfigurationRegistry = $RegistryObj
212203
ConfigurationSecret = $RegistrySecretObj
213204
}
205+
```
214206

207+
```azurepowershell-interactive
215208
New-AzContainerApp @ContainerAppArgs
216209
```
217210

@@ -221,43 +214,61 @@ Now that you have an environment created, you can deploy your first container ap
221214

222215
::: zone pivot="container-apps-public-registry"
223216

224-
# [Bash](#tab/bash)
217+
1. Set the environment variables.
225218

226-
```azurecli-interactive
227-
az containerapp create \
228-
--image <REGISTRY_CONTAINER_NAME> \
229-
--name my-container-app \
230-
--resource-group $RESOURCE_GROUP \
231-
--environment $CONTAINERAPPS_ENVIRONMENT
219+
# [Bash](#tab/bash)
232220

233-
If you have enabled ingress on your container app, you can add `--query properties.configuration.ingress.fqdn` to the `create` command to return the public URL for the application.
221+
```bash
222+
CONTAINER_APP_NAME=my-container-app
223+
CONTAINER_IMAGE_NAME=mcr.microsoft.com/k8se/quickstart:latest
224+
```
234225

235-
```
226+
# [Azure PowerShell](#tab/azure-powershell)
236227

237-
# [Azure PowerShell](#tab/azure-powershell)
228+
```azurepowershell-interactive
229+
$ContainerAppName = "my-container-app"
230+
$ContainerImageName = "mcr.microsoft.com/k8se/quickstart:latest"
231+
```
238232

239-
```azurepowershell-interactive
240-
$TemplateObj = New-AzContainerAppTemplateObject -Name my-container-app -Image "<REGISTRY_CONTAINER_NAME>"
241-
```
233+
1. Deploy a container image to Azure Container Apps.
242234

243-
(Replace the \<REGISTRY_CONTAINER_NAME\> with your value.)
235+
# [Bash](#tab/bash)
244236

245-
```azurepowershell-interactive
246-
$EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $ResourceGroupName -EnvName $ContainerAppsEnvironment).Id
247-
248-
$ContainerAppArgs = @{
249-
Name = "my-container-app"
250-
Location = $Location
251-
ResourceGroupName = $ResourceGroupName
252-
ManagedEnvironmentId = $EnvId
253-
TemplateContainer = $TemplateObj
254-
}
255-
New-AzContainerApp @ContainerAppArgs
256-
```
237+
```azurecli-interactive
238+
az containerapp create \
239+
--image $CONTAINER_IMAGE_NAME \
240+
--name $CONTAINER_APP_NAME \
241+
--resource-group $RESOURCE_GROUP \
242+
--environment $CONTAINERAPPS_ENVIRONMENT
243+
```
257244

258-
---
245+
If you have enabled ingress on your container app, you can add `--query properties.configuration.ingress.fqdn` to the `create` command to return the public URL for the application.
246+
247+
# [Azure PowerShell](#tab/azure-powershell)
248+
249+
```azurepowershell-interactive
250+
$TemplateObj = New-AzContainerAppTemplateObject -Name $ContainerAppName -Image $ContainerImageName
251+
```
252+
253+
```azurepowershell-interactive
254+
$EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $ResourceGroupName -EnvName $ContainerAppsEnvironment).Id
255+
```
256+
257+
```azurepowershell-interactive
258+
$ContainerAppArgs = @{
259+
Name = $ContainerAppName
260+
Location = $Location
261+
ResourceGroupName = $ResourceGroupName
262+
ManagedEnvironmentId = $EnvId
263+
TemplateContainer = $TemplateObj
264+
}
265+
```
266+
267+
```azurepowershell-interactive
268+
New-AzContainerApp @ContainerAppArgs
269+
```
259270

260-
Before you run this command, replace `<REGISTRY_CONTAINER_NAME>` with the full name the public container registry location, including the registry path and tag. For example, a valid container name is `mcr.microsoft.com/k8se/quickstart:latest`.
271+
---
261272

262273
::: zone-end
263274

@@ -274,14 +285,14 @@ LOG_ANALYTICS_WORKSPACE_CLIENT_ID=`az containerapp env show --name $CONTAINERAPP
274285
275286
az monitor log-analytics query \
276287
--workspace $LOG_ANALYTICS_WORKSPACE_CLIENT_ID \
277-
--analytics-query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == 'my-container-app' | project ContainerAppName_s, Log_s, TimeGenerated" \
288+
--analytics-query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == $CONTAINER_APP_NAME | project ContainerAppName_s, Log_s, TimeGenerated" \
278289
--out table
279290
```
280291

281292
# [Azure PowerShell](#tab/azure-powershell)
282293

283294
```azurepowershell-interactive
284-
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WorkspaceId -Query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == 'my-container-app' | project ContainerAppName_s, Log_s, TimeGenerated"
295+
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WorkspaceId -Query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == $ContainerAppName | project ContainerAppName_s, Log_s, TimeGenerated"
285296
$queryResults.Results
286297
```
287298

includes/container-apps-set-environment-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: cshoe
88

99
## Set environment variables
1010

11-
Set the following environment variables. Replace \<PLACEHOLDERS\> with your values:
11+
Set the following environment variables. Replace the `<PLACEHOLDERS>` with your values:
1212

1313
# [Bash](#tab/bash)
1414

0 commit comments

Comments
 (0)