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
@@ -76,6 +90,34 @@ The job uses an Azure Storage queue to receive messages. In this section, you cr
76
90
--connection-string "$QUEUE_CONNECTION_STRING"
77
91
```
78
92
93
+
## Create a user-assigned managed identity
94
+
95
+
You can pull images from private repositories in Microsoft Azure Container Registry using managed identities for authentication to avoid the use of administrative credentials. When possible, you should use a user-assigned managed identity to pull images.
96
+
97
+
# [Bash](#tab/bash)
98
+
99
+
1. Create a user-assigned managed identity. Before you run the following commands, replace the `\<PLACEHOLDERS\>` with the name of your managed identity.
100
+
101
+
```bash
102
+
IDENTITY="<YOUR_IDENTITY_NAME>"
103
+
```
104
+
105
+
```azurecli
106
+
az identity create \
107
+
--name $IDENTITY \
108
+
--resource-group $RESOURCE_GROUP
109
+
```
110
+
111
+
1. Get the identity's resource ID.
112
+
113
+
```azurecli
114
+
IDENTITY_ID=$(az identity show \
115
+
--name $IDENTITY \
116
+
--resource-group $RESOURCE_GROUP \
117
+
--query id \
118
+
--output tsv)
119
+
```
120
+
79
121
## Build and deploy the job
80
122
81
123
To deploy the job, you must first build a container image for the job and push it to a registry. Then, you can deploy the job to the Container Apps environment.
@@ -96,8 +138,21 @@ To deploy the job, you must first build a container image for the job and push i
96
138
--name "$CONTAINER_REGISTRY_NAME" \
97
139
--resource-group "$RESOURCE_GROUP" \
98
140
--location "$LOCATION" \
99
-
--sku Basic \
100
-
--admin-enabled true
141
+
--sku Basic
142
+
```
143
+
144
+
1. Your container registry must allow ARM audience tokens forauthenticationin order to use managed identity to pull images.
145
+
146
+
Use the following command to check if ARM tokens are allowed to access your ACR:
147
+
148
+
```azurecli
149
+
az acr config authentication-as-arm show --registry "$CONTAINER_REGISTRY_NAME"
150
+
```
151
+
152
+
If ARM tokens aren't allowed, allow them with the following command:
153
+
154
+
```azurecli
155
+
az acr config authentication-as-arm update --registry "$CONTAINER_REGISTRY_NAME" --status enabled
101
156
```
102
157
103
158
1. The source code for the job is available on [GitHub](https://github.com/Azure-Samples/container-apps-event-driven-jobs-tutorial). Run the following command to clone the repository and build the container image in the cloud using the `az acr build` command.
@@ -132,6 +187,8 @@ To deploy the job, you must first build a container image for the job and push i
@@ -149,6 +206,8 @@ To deploy the job, you must first build a container image for the job and push i
149
206
| `--scale-rule-auth` | The authentication for the scale rule. |
150
207
| `--secrets` | The secrets to use for the job. |
151
208
| `--registry-server` | The container registry server to use for the job. For an Azure Container Registry, the command automatically configures authentication. |
209
+
| `--mi-user-assigned` | The resource ID of the user-assigned managed identity to assign to the job. |
210
+
| `--registry-identity` | The resource ID of a managed identity to authenticate with the registry server instead of username/password. If possible, an 'acrpull' role assignemnt will be created for the identity automatically. |
152
211
| `--env-vars` | The environment variables to use for the job. |
153
212
154
213
The scale rule configuration defines the event source to monitor. It is evaluated on each polling interval and determines how many job executions to trigger. To learn more, see [Set scaling rules](scale-app.md).
@@ -184,7 +243,7 @@ To verify the job was configured correctly, you can send some messages to the qu
184
243
1. Run the following commands to see logged messages. These commands require the Log analytics extension, so accept the prompt to install extension when requested.
Copy file name to clipboardExpand all lines: includes/container-apps-create-cli-steps-jobs.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,12 @@ ms.custom: references_regions
34
34
az extension add --name containerapp --upgrade
35
35
```
36
36
37
-
1. Register the `Microsoft.App`and `Microsoft.OperationalInsights` namespaces if you haven't already registered them in your Azure subscription.
37
+
1. Register the `Microsoft.App`, `Microsoft.OperationalInsights`, and `Microsoft.Storage` namespaces if you haven't already registered them in your Azure subscription.
38
38
39
39
```azurecli
40
40
az provider register --namespace Microsoft.App
41
41
az provider register --namespace Microsoft.OperationalInsights
42
+
az provider register --namespace Microsoft.Storage
42
43
```
43
44
44
45
1. Now that your Azure CLI setup is complete, you can define the environment variables that are used throughout this article.
0 commit comments