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
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-transfer-images.md
+75-30Lines changed: 75 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,49 @@
1
1
---
2
2
title: Transfer images
3
-
description: You learn how to ...
3
+
description: Transfer images in bulk from one container registry to another registry by creating a transfer pipeline using Azure storage accounts
4
4
ms.topic: article
5
5
ms.date: 03/31/2020
6
6
ms.custom:
7
7
---
8
8
9
9
# Transfer images to another registry
10
10
11
-
[Intro]
11
+
This article shows how to transfer images or other registry artifacts in bulk from one Azure container registry to another registry. The source and target registries can be in the same or different subscriptions, or potentially in different Active Directory tenants or Azure clouds.
12
12
13
-
If you'd like to use the Azure CLI locally, you must have Azure CLI version **XXX** or later installed and logged in with [az login][az-login]. Run `az --version` to find the version. If you need to install or upgrade the CLI, see [Install Azure CLI][azure-cli].
13
+
To transfer images, you create a transfer *pipeline*:
14
+
15
+
* Create source and target storage resources, and store storage access secrets in Azure key vaults
16
+
* Create and run a registry resource to export images to the source storage account
17
+
* Copy images from the source storage account to the target storage account
18
+
* Create a registry resource to import images to the target registry. You can set up the import pipeline to trigger whenever images are in the source storage account
19
+
20
+
Transferring registry images offers a more general, scalable alternative to [importing images](container-registry-import-images.md) from one container registry to another.
21
+
22
+
In this article, you use the Azure CLI and Azure Resource Manager templates to create the resources and transfer pipeline. If you'd like to use the Azure CLI locally, you must have Azure CLI version **XXX** or later installed and logged in with [az login][az-login]. Run `az --version` to find the version. If you need to install or upgrade the CLI, see [Install Azure CLI][azure-cli].
23
+
24
+
This feature is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs](container-registry-skus.md).
14
25
15
26
16
27
## Prerequisites
17
28
18
-
***Storage accounts** - Create source and target storage accounts. If needed, create the storage accounts with the [Azure CLI](../storage/common/storage-account-create.md?tabs=azure-cli) or other tools. The source and target storage accounts can be in the same or a different Azure subscription. For the steps in article, the accounts must be in the same Active Directory tenant.
19
-
***Key vault** for storing secrets - If needed, create a key vault with the [Azure CLI](../key-vault/quick-create-cli.md) or other tools
20
29
***Container registries** - For this scenario you need an existing source registry with images to transfer, and a target registry. The source and target registry can be in the same or a different Azure subscription. For the steps in article, the registries must be in the same Active Directory tenant. If you need to create a registry, see [Quickstart: Create a private container registry using the Azure CLI](container-registry-get-started-cli.md).
30
+
***Storage accounts** - Create source and target storage accounts in the same Azure subscriptions as your source and target registries. If needed, create the storage accounts with the [Azure CLI](../storage/common/storage-account-create.md?tabs=azure-cli) or other tools.
31
+
32
+
[TODO: Needed to create source and target blob containers??]
33
+
34
+
***Key vaults** Create key vaults to store secrets in the same Azure subscriptions as your source and target registries. If needed, create source and target key vaults with the [Azure CLI](../key-vault/quick-create-cli.md) or other tools.
21
35
22
36
## Scenario overview
23
37
24
-
The following three resources are used for ACR Transfer. All are created using PUT operations.
38
+
You create the following three resources for ACR Transfer. All are created using PUT operations.
25
39
26
-
***ExportPipeline** - Longlasting resource that contains high level target info, such as storage blob container URI and the KV secret URI of the target storage SAS token.
40
+
***ExportPipeline** - Long-lasting resource that contains high level target information, such as storage blob container URI and the key vault secret URI of the target storage SAS token.
27
41
***ImportPipeline** - Long lasting resource that contains high level source info, such as storage blob container URI and the KV secret URI of the source storage SAS token. Source trigger is enabled by default so the pipeline will run automatically when artifacts land in the source storage container.
28
42
***PipelineRun** Resource used to invoke either an ExportPipeline or ImportPipeline resource.
29
43
30
-
An ExportPipeline must be run manualIly by creating a PipelineRun resource. When you run the ExportPipeline, you specify the artifacts to be exported.
44
+
An ExportPipeline must be run manually by creating a PipelineRun resource. When you run the ExportPipeline, you specify the artifacts to be exported.
31
45
32
-
An ImportPipeline configured with source trigger enabled is run automatically. It can also be run manually using a PipelineRun.
33
-
34
-
### Assumptions for this article
35
-
* The export and import SAS tokens are located in the same key vault, and a user-assigned identity is shared between export and import.
36
-
* The source and target registries and storage accounts are in the same tenant.
46
+
If a source trigger is enabled, an ImportPipeline runs automatically. It can also be run manually using a PipelineRun.
37
47
38
48
### Alternate scenarios
39
49
* The ImportPipeline and ExportPipeline may be located in different tenants. In this case, you need separate managed identities and key vaults for the export and import resources.
@@ -43,6 +53,8 @@ An ImportPipeline configured with source trigger enabled is run automatically. I
43
53
44
54
Transfer uses shared access signature (SAS) tokens to export to and import from storage accounts. The properties required to create SAS tokens are detailed below.
45
55
56
+
[TODO: Create containers, generate tokens at container level?]
57
+
46
58
### SAS token for export
47
59
48
60
Generate a SAS token for export in the source storage account.
@@ -62,13 +74,13 @@ Copy the generated SAS token and use it to set the EXPORT_SAS environment variab
62
74
EXPORT_SAS='?sv=2019-02-02&...'
63
75
```
64
76
65
-
Store the SAS token in your Azure key vault using [az keyvault secret set][az-keyvault-secret-set]:
77
+
Store the SAS token in your source Azure key vault using [az keyvault secret set][az-keyvault-secret-set]:
66
78
67
79
```azurecli
68
80
az keyvault secret set \
69
81
--name acrexportsas \
70
82
--value $EXPORT_SAS \
71
-
--vault-name mykeyvault
83
+
--vault-name sourcekeyvault
72
84
```
73
85
74
86
### SAS token for import
@@ -89,44 +101,65 @@ Copy the generated SAS token and use it to set the IMPORT_SAS environment variab
89
101
```console
90
102
IMPORT_SAS='?sv=2019-02-02&...'
91
103
92
-
Store the SAS token in your Azure key vault using [az keyvault secret set][az-keyvault-secret-set]:
104
+
Store the SAS token in your target Azure key vault using [az keyvault secret set][az-keyvault-secret-set]:
93
105
94
106
```azurecli
95
107
az keyvault secret set \
96
108
--name acrimportsas \
97
109
--value $IMPORT_SAS \
98
-
--vault-name mykeyvault
110
+
--vault-name targetkeyvault
99
111
```
100
112
101
-
## Create identity
113
+
## Create identities
114
+
115
+
Create user-assigned managed identities for source and target key vaults by running the [az identity create][az-identity-create] command.
102
116
103
-
Create the user-assigned managed identity by running the [az identity create][az-identity-create] command.
104
117
105
-
106
118
```azurecli
119
+
# Managed identity for source vault
107
120
az identity create \
108
121
--resource-group myResourceGroup \
109
-
--name myPipelineId
122
+
--name sourceId
123
+
124
+
# Managed identity for target vault
125
+
az identity create \
126
+
--resource-group myResourceGroup \
127
+
--name targetId
110
128
```
111
129
112
130
Set the following variables using the [az identity show][az-identity-show] command:
Run the [az keyvault set-policy][az-keyvault-set-policy] command to grant the identity access to your key vault:
152
+
Run the [az keyvault set-policy][az-keyvault-set-policy] command to grant each identity access to the respective key vault:
127
153
128
154
```azurecli
129
-
az keyvault set-policy --name mykeyvault \
155
+
# Source key vault
156
+
az keyvault set-policy --name sourcekeyvault \
157
+
--resource-group myResourceGroup \
158
+
--object-id $principalID \
159
+
--secret-permissions get
160
+
161
+
# Target key vault
162
+
az keyvault set-policy --name targetkeyvault \
130
163
--resource-group myResourceGroup \
131
164
--object-id $principalID \
132
165
--secret-permissions get
@@ -154,6 +187,8 @@ az deployment group create \
154
187
155
188
Copy ExportPipeline Resource Manager template files from [here](add link - TBD).
156
189
190
+
[Create a list of images to transfer - what is format?]
191
+
157
192
Run [az deployment group create][az-deployment-group-create] to run the resource.
158
193
159
194
```azurecli
@@ -163,13 +198,20 @@ az group deployment create \
163
198
--parameters azuredeploy.parameters.json
164
199
```
165
200
166
-
[How to specify the artifacts?]
167
-
168
201
## Transfer blob (optional)
169
202
170
203
Copy the blob to the target storage account using the AzCopy command. See [Copy blobs between storage accounts](/storage/common/storage-use-azcopy-blobs.md#copy-blobs-between-storage-accounts).
171
204
172
-
[What does the AzCopy command look like?]
205
+
[TODO: What does the AzCopy command look like? Is it the `azcopy sync` shown below?]
206
+
207
+
Synchronize the source and target storage containers:
0 commit comments