You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -37,126 +37,238 @@ This article demonstrates how to deploy an existing container to Azure Container
37
37
38
38
## Create a container app
39
39
40
-
Now that you have an environment created, you can deploy your first container app. With the `containerapp create` command, deploy a container image to Azure Container Apps.
40
+
Now that you have an environment created, you can deploy your first container app.
41
41
42
-
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:
42
+
::: zone pivot="container-apps-private-registry"
43
43
44
-
- Set the revision mode
45
-
- Define secrets
46
-
- Define environment variables
47
-
- Set container CPU or memory requirements
48
-
- Enable and configure Dapr
49
-
- Enable external or internal ingress
50
-
- Provide minimum and maximum replica values or scale rules
44
+
1. Set the environment variables.
51
45
52
-
::: zone pivot="container-apps-private-registry"
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]`).
53
47
54
-
# [Bash](#tab/bash)
48
+
# [Bash](#tab/bash)
55
49
56
-
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).
50
+
```bash
51
+
CONTAINER_APP_NAME=my-container-app
52
+
KEY_VAULT_NAME=my-key-vault
53
+
USER_PRINCIPAL_NAME=<USER_PRINCIPAL_NAME>
54
+
SECRET_NAME=my-secret-name
55
+
CONTAINER_IMAGE_NAME=<CONTAINER_IMAGE_NAME>
56
+
REGISTRY_SERVER=<REGISTRY_SERVER>
57
+
REGISTRY_USERNAME=<REGISTRY_USERNAME>
58
+
```
57
59
58
-
```bash
59
-
CONTAINER_IMAGE_NAME=<CONTAINER_IMAGE_NAME>
60
-
REGISTRY_SERVER=<REGISTRY_SERVER>
61
-
REGISTRY_USERNAME=<REGISTRY_USERNAME>
62
-
REGISTRY_PASSWORD=<REGISTRY_PASSWORD>
63
-
```
60
+
# [Azure PowerShell](#tab/azure-powershell)
64
61
65
-
(Replace the \<placeholders\> with your values.)
62
+
```azurepowershell-interactive
63
+
$ContainerAppName = "my-container-app"
64
+
$KeyVaultName = "my-key-vault"
65
+
$UserPrincipalName = "<USER_PRINCIPAL_NAME>"
66
+
$SecretName = "my-secret-name"
67
+
$ContainerImageName = "<CONTAINER_IMAGE_NAME>"
68
+
$RegistryServer = "<REGISTRY_SERVER>"
69
+
$RegistryUsername = "<REGISTRY_USERNAME>"
70
+
```
66
71
67
-
```azurecli-interactive
68
-
az containerapp create \
69
-
--name my-container-app \
70
-
--resource-group $RESOURCE_GROUP \
71
-
--image $CONTAINER_IMAGE_NAME \
72
-
--environment $CONTAINERAPPS_ENVIRONMENT \
73
-
--registry-server $REGISTRY_SERVER \
74
-
--registry-username $REGISTRY_USERNAME \
75
-
--registry-password $REGISTRY_PASSWORD
76
-
```
72
+
---
77
73
78
-
# [Azure PowerShell](#tab/azure-powershell)
74
+
1. Create the key vault.
79
75
80
-
```azurepowershell-interactive
81
-
$ContainerImageName = "<CONTAINER_IMAGE_NAME>"
82
-
$RegistryServer = "<REGISTRY_SERVER>"
83
-
$RegistryUsername = "<REGISTRY_USERNAME>"
84
-
$RegistryPassword = "<REGISTRY_PASSWORD>"
85
-
```
76
+
Storing your container registry password using a service such as [Azure Key Vault](/azure/key-vault/general/basic-concepts) keeps the values secure at all times. The steps in this section show how to create a key vault, store your container registry password the Key Vault, and then retrieve the password for use in your code.
1. Deploy a container image to Azure Container Apps.
152
+
153
+
# [Bash](#tab/bash)
154
+
155
+
```azurecli-interactive
156
+
az containerapp create \
157
+
--name $CONTAINER_APP_NAME \
158
+
--location $LOCATION \
159
+
--resource-group $RESOURCE_GROUP \
160
+
--image $CONTAINER_IMAGE_NAME \
161
+
--environment $CONTAINERAPPS_ENVIRONMENT \
162
+
--registry-server $REGISTRY_SERVER \
163
+
--registry-username $REGISTRY_USERNAME \
164
+
--registry-password $REGISTRY_PASSWORD
165
+
```
166
+
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.
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.
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.
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`.
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
+
```
270
+
271
+
---
160
272
161
273
::: zone-end
162
274
@@ -173,14 +285,14 @@ LOG_ANALYTICS_WORKSPACE_CLIENT_ID=`az containerapp env show --name $CONTAINERAPP
0 commit comments