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,32 @@ 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
+
To avoid using administrative credentials, pull images from private repositories in Microsoft Azure Container Registry using managed identities for authentication. When possible, use a user-assigned managed identity to pull images.
96
+
97
+
1. Create a user-assigned managed identity. Before you run the following commands, choose a name for your managed identity and replace the `\<PLACEHOLDER\>` with the name.
98
+
99
+
```bash
100
+
IDENTITY="<YOUR_IDENTITY_NAME>"
101
+
```
102
+
103
+
```azurecli
104
+
az identity create \
105
+
--name $IDENTITY \
106
+
--resource-group $RESOURCE_GROUP
107
+
```
108
+
109
+
1. Get the identity's resource ID.
110
+
111
+
```azurecli
112
+
IDENTITY_ID=$(az identity show \
113
+
--name $IDENTITY \
114
+
--resource-group $RESOURCE_GROUP \
115
+
--query id \
116
+
--output tsv)
117
+
```
118
+
79
119
## Build and deploy the job
80
120
81
121
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 +136,29 @@ To deploy the job, you must first build a container image for the job and push i
96
136
--name "$CONTAINER_REGISTRY_NAME" \
97
137
--resource-group "$RESOURCE_GROUP" \
98
138
--location "$LOCATION" \
99
-
--sku Basic \
100
-
--admin-enabled true
139
+
--sku Basic
140
+
```
141
+
142
+
1. Your container registry must allow Azure Resource Manager (ARM) audience tokens forauthenticationin order to use managed identity to pull images.
143
+
144
+
Use the following command to check if ARM tokens are allowed to access your Azure Container Registry (ACR).
145
+
146
+
```azurecli
147
+
az acr config authentication-as-arm show --registry "$CONTAINER_REGISTRY_NAME"
148
+
```
149
+
150
+
If ARM tokens are allowed, the command outputs the following.
151
+
152
+
```
153
+
{
154
+
"status": "enabled"
155
+
}
156
+
```
157
+
158
+
If the `status` is `disabled`, allow ARM tokens with the following command.
159
+
160
+
```azurecli
161
+
az acr config authentication-as-arm update --registry "$CONTAINER_REGISTRY_NAME" --status enabled
101
162
```
102
163
103
164
1. The source code forthe 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 imagein the cloud using the `az acr build` command.
@@ -132,6 +193,8 @@ To deploy the job, you must first build a container image for the job and push i
@@ -149,6 +212,8 @@ To deploy the job, you must first build a container image for the job and push i
149
212
|`--scale-rule-auth`| The authentication for the scale rule. |
150
213
|`--secrets`| The secrets to use for the job. |
151
214
|`--registry-server`| The container registry server to use for the job. For an Azure Container Registry, the command automatically configures authentication. |
215
+
|`--mi-user-assigned`| The resource ID of the user-assigned managed identity to assign to the job. |
216
+
|`--registry-identity`| The resource ID of a managed identity to authenticate with the registry server instead of using a username and password. If possible, an 'acrpull' role assignment is created for the identity automatically. |
152
217
|`--env-vars`| The environment variables to use for the job. |
153
218
154
219
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 +249,7 @@ To verify the job was configured correctly, you can send some messages to the qu
184
249
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