Copies an image to this container registry from the specified container registry.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage?api-version=2023-01-01-preview
URI Parameters
Name |
In |
Required |
Type |
Description |
registryName
|
path |
True
|
string
|
The name of the container registry.
Regex pattern: ^[a-zA-Z0-9]*$
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
uuid
|
The ID of the target subscription. The value must be an UUID.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Request Body
Name |
Required |
Type |
Description |
source
|
True
|
ImportSource
|
The source of the image.
|
mode
|
|
ImportMode
|
When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins.
|
targetTags
|
|
string[]
|
List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted).
|
untaggedTargetRepositories
|
|
string[]
|
List of strings of repository names to do a manifest only copy. No tag will be created.
|
Responses
Name |
Type |
Description |
200 OK
|
|
The request was successful; the operation has completed successfully.
|
202 Accepted
|
|
The request was successful; the operation will complete asynchronously.
Headers
Location: string
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
ImportImageByManifestDigest
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importImage?api-version=2023-01-01-preview
{
"source": {
"resourceId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry",
"sourceImage": "sourceRepository@sha256:0000000000000000000000000000000000000000000000000000000000000000"
},
"targetTags": [
"targetRepository:targetTag"
],
"untaggedTargetRepositories": [
"targetRepository1"
],
"mode": "Force"
}
package armcontainerregistry_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageByManifestDigest.json
func ExampleRegistriesClient_BeginImportImage_importImageByManifestDigest() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerregistry.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewRegistriesClient().BeginImportImage(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.ImportImageParameters{
Mode: to.Ptr(armcontainerregistry.ImportModeForce),
Source: &armcontainerregistry.ImportSource{
ResourceID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry"),
SourceImage: to.Ptr("sourceRepository@sha256:0000000000000000000000000000000000000000000000000000000000000000"),
},
TargetTags: []*string{
to.Ptr("targetRepository:targetTag")},
UntaggedTargetRepositories: []*string{
to.Ptr("targetRepository1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerRegistryManagementClient } = require("@azure/arm-containerregistry");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Copies an image to this container registry from the specified container registry.
*
* @summary Copies an image to this container registry from the specified container registry.
* x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageByManifestDigest.json
*/
async function importImageByManifestDigest() {
const subscriptionId =
process.env["CONTAINERREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const registryName = "myRegistry";
const parameters = {
mode: "Force",
source: {
resourceId:
"/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry",
sourceImage:
"sourceRepository@sha256:0000000000000000000000000000000000000000000000000000000000000000",
},
targetTags: ["targetRepository:targetTag"],
untaggedTargetRepositories: ["targetRepository1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerRegistryManagementClient(credential, subscriptionId);
const result = await client.registries.beginImportImageAndWait(
resourceGroupName,
registryName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/locations/location/operationResults/operationStatuses/registries-00000000-0000-0000-0000-000000000000?api-version=2023-01-01-preview
ImportImageByTag
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importImage?api-version=2023-01-01-preview
{
"source": {
"resourceId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry",
"sourceImage": "sourceRepository:sourceTag"
},
"targetTags": [
"targetRepository:targetTag"
],
"untaggedTargetRepositories": [
"targetRepository1"
],
"mode": "Force"
}
package armcontainerregistry_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageByTag.json
func ExampleRegistriesClient_BeginImportImage_importImageByTag() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerregistry.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewRegistriesClient().BeginImportImage(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.ImportImageParameters{
Mode: to.Ptr(armcontainerregistry.ImportModeForce),
Source: &armcontainerregistry.ImportSource{
ResourceID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry"),
SourceImage: to.Ptr("sourceRepository:sourceTag"),
},
TargetTags: []*string{
to.Ptr("targetRepository:targetTag")},
UntaggedTargetRepositories: []*string{
to.Ptr("targetRepository1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerRegistryManagementClient } = require("@azure/arm-containerregistry");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Copies an image to this container registry from the specified container registry.
*
* @summary Copies an image to this container registry from the specified container registry.
* x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageByTag.json
*/
async function importImageByTag() {
const subscriptionId =
process.env["CONTAINERREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const registryName = "myRegistry";
const parameters = {
mode: "Force",
source: {
resourceId:
"/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry",
sourceImage: "sourceRepository:sourceTag",
},
targetTags: ["targetRepository:targetTag"],
untaggedTargetRepositories: ["targetRepository1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerRegistryManagementClient(credential, subscriptionId);
const result = await client.registries.beginImportImageAndWait(
resourceGroupName,
registryName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/locations/location/operationResults/operationStatuses/registries-00000000-0000-0000-0000-000000000000?api-version=2023-01-01-preview
ImportImageFromPublicRegistry
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importImage?api-version=2023-01-01-preview
{
"source": {
"registryUri": "registry.hub.docker.com",
"sourceImage": "library/hello-world"
},
"targetTags": [
"targetRepository:targetTag"
],
"untaggedTargetRepositories": [
"targetRepository1"
],
"mode": "Force"
}
package armcontainerregistry_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageFromPublicRegistry.json
func ExampleRegistriesClient_BeginImportImage_importImageFromPublicRegistry() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerregistry.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewRegistriesClient().BeginImportImage(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.ImportImageParameters{
Mode: to.Ptr(armcontainerregistry.ImportModeForce),
Source: &armcontainerregistry.ImportSource{
RegistryURI: to.Ptr("registry.hub.docker.com"),
SourceImage: to.Ptr("library/hello-world"),
},
TargetTags: []*string{
to.Ptr("targetRepository:targetTag")},
UntaggedTargetRepositories: []*string{
to.Ptr("targetRepository1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerRegistryManagementClient } = require("@azure/arm-containerregistry");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Copies an image to this container registry from the specified container registry.
*
* @summary Copies an image to this container registry from the specified container registry.
* x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageFromPublicRegistry.json
*/
async function importImageFromPublicRegistry() {
const subscriptionId =
process.env["CONTAINERREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const registryName = "myRegistry";
const parameters = {
mode: "Force",
source: {
registryUri: "registry.hub.docker.com",
sourceImage: "library/hello-world",
},
targetTags: ["targetRepository:targetTag"],
untaggedTargetRepositories: ["targetRepository1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerRegistryManagementClient(credential, subscriptionId);
const result = await client.registries.beginImportImageAndWait(
resourceGroupName,
registryName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/locations/location/operationResults/operationStatuses/registries-00000000-0000-0000-0000-000000000000?api-version=2023-01-01-preview
Definitions
ImportImageParameters
Name |
Type |
Default Value |
Description |
mode
|
ImportMode
|
NoForce
|
When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins.
|
source
|
ImportSource
|
|
The source of the image.
|
targetTags
|
string[]
|
|
List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted).
|
untaggedTargetRepositories
|
string[]
|
|
List of strings of repository names to do a manifest only copy. No tag will be created.
|
ImportMode
When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins.
Name |
Type |
Description |
Force
|
string
|
|
NoForce
|
string
|
|
ImportSource
Name |
Type |
Description |
credentials
|
ImportSourceCredentials
|
Credentials used when importing from a registry uri.
|
registryUri
|
string
|
The address of the source registry (e.g. 'mcr.microsoft.com').
|
resourceId
|
string
|
The resource identifier of the source Azure Container Registry.
|
sourceImage
|
string
|
Repository name of the source image.
Specify an image by repository ('hello-world'). This will use the 'latest' tag.
Specify an image by tag ('hello-world:latest').
Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123').
|
ImportSourceCredentials
Name |
Type |
Description |
password
|
string
|
The password used to authenticate with the source registry.
|
username
|
string
|
The username to authenticate with the source registry.
|