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
@@ -54,7 +54,7 @@ Storage authentication uses SAS tokens, managed as secrets in key vaults. The pi
54
54
55
55
### Things to know
56
56
* The ExportPipeline and ImportPipeline will typically be in different Active Directory tenants associated with the source and destination clouds. This scenario requires separate managed identities and key vaults for the export and import resources. For testing purposes, these resources can be placed in the same cloud, sharing identities.
57
-
* ExportPipelines and ImportPipelines also support system-assigned identities. In this case, assign the identity permissions to your key vault after the ExportPipeline resource is created and before running.
57
+
*The pipeline examples create system-assigned managed identities to access key vault secrets. ExportPipelines and ImportPipelines also support user-assigned identities. In this case, you must configure the key vaults with access policies for the identities.
58
58
59
59
## Create and store SAS keys
60
60
@@ -89,16 +89,6 @@ az keyvault secret set \
89
89
--vault-name $SOURCE_KV
90
90
```
91
91
92
-
In the command output, take note of the secret's URI (`id`). You use the URI in the export pipelines. The following example uses the [az keyvault secret show][az-keyvault-secret-show] command to store the value in the EXPORT_KV_URI variable:
93
-
94
-
```azurecli
95
-
EXPORT_KV_URI=$(az keyvault secret show \
96
-
--name acrexportsas \
97
-
--vault-name $SOURCE_KV \
98
-
--query 'id' \
99
-
--output tsv)
100
-
```
101
-
102
92
### Generate SAS token for import
103
93
104
94
Run the [az storage container generate-sas][az-storage-container-generate-sas] command to generate a SAS token for the container in the target storage account, used for artifact import.
@@ -128,70 +118,6 @@ az keyvault secret set \
128
118
--vault-name $TARGET_KV
129
119
```
130
120
131
-
In the command output, take note of the secret's URI (`id`). You use the URI in the export pipelines. The following example uses the [az keyvault secret show][az-keyvault-secret-show] command to store the value in the IMPORT_KV_URI variable:
132
-
133
-
```azurecli
134
-
IMPORT_KV_URI=$(az keyvault secret show \
135
-
--name acrimportsas \
136
-
--vault-name $TARGET_KV \
137
-
--query 'id' \
138
-
--output tsv)
139
-
```
140
-
141
-
## Create identities
142
-
143
-
Create user-assigned managed identities to access source and target key vaults by running the [az identity create][az-identity-create] command.
144
-
145
-
```azurecli
146
-
# Managed identity to access source vault
147
-
az identity create \
148
-
--resource-group $SOURCE_RG \
149
-
--name sourceId
150
-
151
-
# Managed identity to access target vault
152
-
az identity create \
153
-
--resource-group $TARGET_RG \
154
-
--name targetId
155
-
```
156
-
157
-
Set the following variables using the [az identity show][az-identity-show] command:
158
-
159
-
```azurecli
160
-
SOURCE_PR_ID=$(az identity show \
161
-
--resource-group $SOURCE_RG \
162
-
--name sourceId --query principalId --output tsv)
163
-
164
-
SOURCE_RES_ID=$(az identity show \
165
-
--resource-group $SOURCE_RG \
166
-
--name sourceId --query id --output tsv)
167
-
168
-
TARGET_PR_ID=$(az identity show \
169
-
--resource-group $TARGET_RG \
170
-
--name targetId --query principalId --output tsv)
171
-
172
-
TARGET_RES_ID=$(az identity show \
173
-
--resource-group $TARGET_RG \
174
-
--name targetId --query id --output tsv)
175
-
```
176
-
177
-
## Grant each identity access to key vault
178
-
179
-
Run the [az keyvault set-policy][az-keyvault-set-policy] command to grant the source and target identities access to their respective key vaults:
180
-
181
-
```azurecli
182
-
# Source key vault
183
-
az keyvault set-policy --name $SOURCE_KV \
184
-
--resource-group $SOURCE_RG \
185
-
--object-id $SOURCE_PR_ID \
186
-
--secret-permissions get
187
-
188
-
# Target key vault
189
-
az keyvault set-policy --name $TARGET_KV \
190
-
--resource-group $TARGET_RG \
191
-
--object-id $TARGET_PR_ID \
192
-
--secret-permissions get
193
-
```
194
-
195
121
## Create ExportPipeline with Resource Manager
196
122
197
123
Create an ExportPipeline resource for your source container registry using Azure Resource Manager template deployment. The ExportPipeline resource is provisioned with the source user-assigned identity you created in the previous section.
@@ -205,15 +131,16 @@ Enter the following parameter values in the file `azuredeploy.parameters.json`:
205
131
|registryName | Name of your source container registry |
206
132
|exportPipelineName | Name you choose for the export pipeline |
207
133
|targetUri | URI of the storage container in your source environment (the target of the export pipeline).<br/>Example: `https://sourcestorage.blob.core.windows.net/transfer`|
208
-
|keyVaultUri | URI of the SAS token secret in the source key vault, stored previously in the EXPORT_KV_URI variable. <br/>Example: `https://sourcevault.vault-int.azure-int.net/secrets/acrexportsas/xxxxxxxxxx`|
134
+
|keyVaultName | Name of the source key vault |
135
+
|sasTokenSecretName | Name of the SAS token secret in the source key vault <br/>Example: acrexportsas
209
136
210
137
### Export options
211
138
212
-
The `Options` property for the export pipelines supports optional boolean values. The following values are recommended:
139
+
The `options` property for the export pipelines supports optional boolean values. The following values are recommended:
213
140
214
141
|Parameter |Description |
215
142
|---------|---------|
216
-
|Options | OverwriteBlobs - Existing target blobs are overwritten<br/>ContinueOnErrors - Continue export of remaining artifacts in the source registry if one artifact export fails.
143
+
|options | OverwriteBlobs - Existing target blobs are overwritten<br/>ContinueOnErrors - Continue export of remaining artifacts in the source registry if one artifact export fails.
217
144
218
145
### Create the resource
219
146
@@ -224,14 +151,17 @@ az deployment group create \
224
151
--resource-group $SOURCE_RG \
225
152
--template-file azuredeploy.json \
226
153
--name exportPipeline \
227
-
--parameters azuredeploy.parameters.json \
228
-
--parameters userAssignedIdentity=$SOURCE_RES_ID
154
+
--parameters azuredeploy.parameters.json
229
155
```
230
156
231
-
Take note of the resource ID (`id`) of the pipeline, which is used in later steps. Example:
157
+
In the command output, take note of the resource ID (`id`) of the pipeline. You can store this value in an environment variable for later use by running the [az deployment group show][az-deployment-group-show]. For example:
|registryName | Name of your target container registry |
248
178
|importPipelineName | Name you choose for the import pipeline |
249
179
|sourceUri | URI of the storage container in your target environment (the source for the import pipeline).<br/>Example: `https://targetstorage.blob.core.windows.net/transfer/`|
250
-
|keyVaultUri | URI of the SAS token secret in the target key vault, stored previously in the IMPORT_KV_URI variable.<br/>Example: `https://targetvault.vault-int.azure-int.net/secrets/acrimportsas/xxxxxxxxxx`|
180
+
|keyVaultName | Name of the target key vault |
181
+
|sasTokenSecretName | Name of the SAS token secret in the target key vault<br/>Example: acr importsas |
251
182
252
183
### Import options
253
184
254
-
The `Options` property for the import pipeline supports optional boolean values. The following values are recommended:
185
+
The `options` property for the import pipeline supports optional boolean values. The following values are recommended:
255
186
256
187
|Parameter |Description |
257
188
|---------|---------|
258
-
|Options | OverwriteTags - Existing target tags are overwritten<br/>DeleteSourceBlobOnSuccess - Delete the source storage blob after successful import to the target registry<br/>ContinueOnErrors - Continue import of remaining artifacts in the target registry if one artifact import fails.
189
+
|options | OverwriteTags - Existing target tags are overwritten<br/>DeleteSourceBlobOnSuccess - Delete the source storage blob after successful import to the target registry<br/>ContinueOnErrors - Continue import of remaining artifacts in the target registry if one artifact import fails.
259
190
260
191
### Create the resource
261
192
@@ -266,25 +197,22 @@ az deployment group create \
266
197
--resource-group $TARGET_RG \
267
198
--template-file azuredeploy.json \
268
199
--parameters azuredeploy.parameters.json \
269
-
--name importPipeline \
270
-
--parameters userAssignedIdentity=$TARGET_RES_ID
271
-
```
272
-
273
-
If you plan to run the import manually, take note of the resource ID (`id`) of the pipeline, which is used in later steps. Example:
It can take several minutes for artifacts to import. When the import completes successfully, verify artifact import by listing the repositories in the target container registry. For example, run [az acr repository list][az-acr-repository-list]:
203
+
If you plan to run the import manually, take note of the resource ID (`id`) of the pipeline. You can store this value in an environment variable for later use by running the [az deployment group show][az-deployment-group-show]. For example:
280
204
281
205
```azurecli
282
-
az acr repository list --name <target-registry-name>
206
+
IMPORT_RES_ID=$(az group deployment show \
207
+
--resource-group $TARGET_RG \
208
+
--name importPipeline \
209
+
--query 'properties.outputResources[1].id' \
210
+
--output tsv)
283
211
```
284
212
285
213
## Create PipelineRun with Resource Manager
286
214
287
-
Create a PipelineRun resource for your source container registry using Azure Resource Manager template deployment. This resource runs the ExportPipeline resource you created in the previous step, and exports specified artifacts from your container registry as a blob to your source storage account.
215
+
Create a PipelineRun resource for your source container registry using Azure Resource Manager template deployment. This resource runs the ExportPipeline resource you created previously, and exports specified artifacts from your container registry as a blob to your source storage account.
288
216
289
217
Copy PipelineRun Resource Manager [template files](https://github.com/Azure/acr/tree/master/docs/image-transfer/PipelineRun) to a local folder.
290
218
@@ -296,7 +224,7 @@ Enter the following parameter values in the file `azuredeploy.parameters.json`:
296
224
|pipelineRunName | Name you choose for the run |
297
225
|pipelineResourceId | Resource ID of the export pipeline.<br/>Example: `/subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.ContainerRegistry/registries/<sourceRegistryName>/exportPipelines/myExportPipeline`|
298
226
|targetName | Name you choose for the artifacts blob exported to your source storage account, such as *myblob*
299
-
|artifacts | Array of source artifacts to transfer, as tags or manifest digests<br/>Example: `[samples/hello-world:v1", "samples/nginx:v1"]`
227
+
|artifacts | Array of source artifacts to transfer, as tags or manifest digests<br/>Example: `[samples/hello-world:v1", "samples/nginx:v1"]`|
300
228
301
229
Run [az deployment group create][az-deployment-group-create] to create the PipelineRun resource. The following example names the deployment *exportPipelineRun*.
302
230
@@ -333,11 +261,17 @@ azcopy sync \
333
261
--recursive
334
262
```
335
263
336
-
If you enabled the `sourceTriggerStatus` parameter of the import pipeline (the default value), the import pipeline will trigger. Import may take place after several minutes.
264
+
## Trigger ImportPipeline resource
265
+
266
+
If you enabled the `sourceTriggerStatus` parameter of the ImportPipeline (the default value), the pipeline is triggered after the blob is copied to the target storage account. It can take several minutes for artifacts to import. When the import completes successfully, verify artifact import by listing the repositories in the target container registry. For example, run [az acr repository list][az-acr-repository-list]:
267
+
268
+
```azurecli
269
+
az acr repository list --name <target-registry-name>
270
+
```
337
271
338
272
If you didn't enable the `sourceTriggerStatus` parameter of the import pipeline, run the ImportPipeline resource manually, as shown in the following section.
339
273
340
-
### Run the ImportPipeline resource manually (optional)
274
+
### Run ImportPipeline resource manually (optional)
341
275
342
276
You can also use a PipelineRun resource to trigger an ImportPipeline for artifact import to your target container registry.
0 commit comments