1. Packages
  2. Azure Classic
  3. API Docs
  4. containerservice
  5. RegistryToken

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.containerservice.RegistryToken

Explore with Pulumi AI

Manages an Azure Container Registry token associated to a scope map. For more information on scope maps and their tokens see the product documentation.

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "example-resource-group",
    location: "West Europe",
});
const exampleRegistry = new azure.containerservice.Registry("example", {
    name: "example",
    resourceGroupName: example.name,
    location: example.location,
    sku: "Basic",
    adminEnabled: false,
    georeplications: [
        {
            location: "East US",
        },
        {
            location: "West Europe",
        },
    ],
});
const exampleRegistryScopeMap = new azure.containerservice.RegistryScopeMap("example", {
    name: "example-scope-map",
    containerRegistryName: exampleRegistry.name,
    resourceGroupName: example.name,
    actions: [
        "repositories/repo1/content/read",
        "repositories/repo1/content/write",
    ],
});
const exampleRegistryToken = new azure.containerservice.RegistryToken("example", {
    name: "exampletoken",
    containerRegistryName: exampleRegistry.name,
    resourceGroupName: example.name,
    scopeMapId: exampleRegistryScopeMap.id,
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-resource-group",
    location="West Europe")
example_registry = azure.containerservice.Registry("example",
    name="example",
    resource_group_name=example.name,
    location=example.location,
    sku="Basic",
    admin_enabled=False,
    georeplications=[
        {
            "location": "East US",
        },
        {
            "location": "West Europe",
        },
    ])
example_registry_scope_map = azure.containerservice.RegistryScopeMap("example",
    name="example-scope-map",
    container_registry_name=example_registry.name,
    resource_group_name=example.name,
    actions=[
        "repositories/repo1/content/read",
        "repositories/repo1/content/write",
    ])
example_registry_token = azure.containerservice.RegistryToken("example",
    name="exampletoken",
    container_registry_name=example_registry.name,
    resource_group_name=example.name,
    scope_map_id=example_registry_scope_map.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/containerservice"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resource-group"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleRegistry, err := containerservice.NewRegistry(ctx, "example", &containerservice.RegistryArgs{
			Name:              pulumi.String("example"),
			ResourceGroupName: example.Name,
			Location:          example.Location,
			Sku:               pulumi.String("Basic"),
			AdminEnabled:      pulumi.Bool(false),
			Georeplications: containerservice.RegistryGeoreplicationArray{
				&containerservice.RegistryGeoreplicationArgs{
					Location: pulumi.String("East US"),
				},
				&containerservice.RegistryGeoreplicationArgs{
					Location: pulumi.String("West Europe"),
				},
			},
		})
		if err != nil {
			return err
		}
		exampleRegistryScopeMap, err := containerservice.NewRegistryScopeMap(ctx, "example", &containerservice.RegistryScopeMapArgs{
			Name:                  pulumi.String("example-scope-map"),
			ContainerRegistryName: exampleRegistry.Name,
			ResourceGroupName:     example.Name,
			Actions: pulumi.StringArray{
				pulumi.String("repositories/repo1/content/read"),
				pulumi.String("repositories/repo1/content/write"),
			},
		})
		if err != nil {
			return err
		}
		_, err = containerservice.NewRegistryToken(ctx, "example", &containerservice.RegistryTokenArgs{
			Name:                  pulumi.String("exampletoken"),
			ContainerRegistryName: exampleRegistry.Name,
			ResourceGroupName:     example.Name,
			ScopeMapId:            exampleRegistryScopeMap.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resource-group",
        Location = "West Europe",
    });

    var exampleRegistry = new Azure.ContainerService.Registry("example", new()
    {
        Name = "example",
        ResourceGroupName = example.Name,
        Location = example.Location,
        Sku = "Basic",
        AdminEnabled = false,
        Georeplications = new[]
        {
            new Azure.ContainerService.Inputs.RegistryGeoreplicationArgs
            {
                Location = "East US",
            },
            new Azure.ContainerService.Inputs.RegistryGeoreplicationArgs
            {
                Location = "West Europe",
            },
        },
    });

    var exampleRegistryScopeMap = new Azure.ContainerService.RegistryScopeMap("example", new()
    {
        Name = "example-scope-map",
        ContainerRegistryName = exampleRegistry.Name,
        ResourceGroupName = example.Name,
        Actions = new[]
        {
            "repositories/repo1/content/read",
            "repositories/repo1/content/write",
        },
    });

    var exampleRegistryToken = new Azure.ContainerService.RegistryToken("example", new()
    {
        Name = "exampletoken",
        ContainerRegistryName = exampleRegistry.Name,
        ResourceGroupName = example.Name,
        ScopeMapId = exampleRegistryScopeMap.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.containerservice.Registry;
import com.pulumi.azure.containerservice.RegistryArgs;
import com.pulumi.azure.containerservice.inputs.RegistryGeoreplicationArgs;
import com.pulumi.azure.containerservice.RegistryScopeMap;
import com.pulumi.azure.containerservice.RegistryScopeMapArgs;
import com.pulumi.azure.containerservice.RegistryToken;
import com.pulumi.azure.containerservice.RegistryTokenArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resource-group")
            .location("West Europe")
            .build());

        var exampleRegistry = new Registry("exampleRegistry", RegistryArgs.builder()
            .name("example")
            .resourceGroupName(example.name())
            .location(example.location())
            .sku("Basic")
            .adminEnabled(false)
            .georeplications(            
                RegistryGeoreplicationArgs.builder()
                    .location("East US")
                    .build(),
                RegistryGeoreplicationArgs.builder()
                    .location("West Europe")
                    .build())
            .build());

        var exampleRegistryScopeMap = new RegistryScopeMap("exampleRegistryScopeMap", RegistryScopeMapArgs.builder()
            .name("example-scope-map")
            .containerRegistryName(exampleRegistry.name())
            .resourceGroupName(example.name())
            .actions(            
                "repositories/repo1/content/read",
                "repositories/repo1/content/write")
            .build());

        var exampleRegistryToken = new RegistryToken("exampleRegistryToken", RegistryTokenArgs.builder()
            .name("exampletoken")
            .containerRegistryName(exampleRegistry.name())
            .resourceGroupName(example.name())
            .scopeMapId(exampleRegistryScopeMap.id())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resource-group
      location: West Europe
  exampleRegistry:
    type: azure:containerservice:Registry
    name: example
    properties:
      name: example
      resourceGroupName: ${example.name}
      location: ${example.location}
      sku: Basic
      adminEnabled: false
      georeplications:
        - location: East US
        - location: West Europe
  exampleRegistryScopeMap:
    type: azure:containerservice:RegistryScopeMap
    name: example
    properties:
      name: example-scope-map
      containerRegistryName: ${exampleRegistry.name}
      resourceGroupName: ${example.name}
      actions:
        - repositories/repo1/content/read
        - repositories/repo1/content/write
  exampleRegistryToken:
    type: azure:containerservice:RegistryToken
    name: example
    properties:
      name: exampletoken
      containerRegistryName: ${exampleRegistry.name}
      resourceGroupName: ${example.name}
      scopeMapId: ${exampleRegistryScopeMap.id}
Copy

Create RegistryToken Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RegistryToken(name: string, args: RegistryTokenArgs, opts?: CustomResourceOptions);
@overload
def RegistryToken(resource_name: str,
                  args: RegistryTokenArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def RegistryToken(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  container_registry_name: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  scope_map_id: Optional[str] = None,
                  enabled: Optional[bool] = None,
                  name: Optional[str] = None)
func NewRegistryToken(ctx *Context, name string, args RegistryTokenArgs, opts ...ResourceOption) (*RegistryToken, error)
public RegistryToken(string name, RegistryTokenArgs args, CustomResourceOptions? opts = null)
public RegistryToken(String name, RegistryTokenArgs args)
public RegistryToken(String name, RegistryTokenArgs args, CustomResourceOptions options)
type: azure:containerservice:RegistryToken
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RegistryTokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RegistryTokenArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RegistryTokenArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RegistryTokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RegistryTokenArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var registryTokenResource = new Azure.ContainerService.RegistryToken("registryTokenResource", new()
{
    ContainerRegistryName = "string",
    ResourceGroupName = "string",
    ScopeMapId = "string",
    Enabled = false,
    Name = "string",
});
Copy
example, err := containerservice.NewRegistryToken(ctx, "registryTokenResource", &containerservice.RegistryTokenArgs{
	ContainerRegistryName: pulumi.String("string"),
	ResourceGroupName:     pulumi.String("string"),
	ScopeMapId:            pulumi.String("string"),
	Enabled:               pulumi.Bool(false),
	Name:                  pulumi.String("string"),
})
Copy
var registryTokenResource = new RegistryToken("registryTokenResource", RegistryTokenArgs.builder()
    .containerRegistryName("string")
    .resourceGroupName("string")
    .scopeMapId("string")
    .enabled(false)
    .name("string")
    .build());
Copy
registry_token_resource = azure.containerservice.RegistryToken("registryTokenResource",
    container_registry_name="string",
    resource_group_name="string",
    scope_map_id="string",
    enabled=False,
    name="string")
Copy
const registryTokenResource = new azure.containerservice.RegistryToken("registryTokenResource", {
    containerRegistryName: "string",
    resourceGroupName: "string",
    scopeMapId: "string",
    enabled: false,
    name: "string",
});
Copy
type: azure:containerservice:RegistryToken
properties:
    containerRegistryName: string
    enabled: false
    name: string
    resourceGroupName: string
    scopeMapId: string
Copy

RegistryToken Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RegistryToken resource accepts the following input properties:

ContainerRegistryName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Container Registry. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
ScopeMapId This property is required. string
The ID of the Container Registry Scope Map associated with the token.
Enabled bool
Should the Container Registry token be enabled? Defaults to true.
Name Changes to this property will trigger replacement. string
Specifies the name of the token. Changing this forces a new resource to be created.
ContainerRegistryName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Container Registry. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
ScopeMapId This property is required. string
The ID of the Container Registry Scope Map associated with the token.
Enabled bool
Should the Container Registry token be enabled? Defaults to true.
Name Changes to this property will trigger replacement. string
Specifies the name of the token. Changing this forces a new resource to be created.
containerRegistryName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Container Registry. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scopeMapId This property is required. String
The ID of the Container Registry Scope Map associated with the token.
enabled Boolean
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. String
Specifies the name of the token. Changing this forces a new resource to be created.
containerRegistryName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Container Registry. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scopeMapId This property is required. string
The ID of the Container Registry Scope Map associated with the token.
enabled boolean
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. string
Specifies the name of the token. Changing this forces a new resource to be created.
container_registry_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Container Registry. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scope_map_id This property is required. str
The ID of the Container Registry Scope Map associated with the token.
enabled bool
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. str
Specifies the name of the token. Changing this forces a new resource to be created.
containerRegistryName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Container Registry. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scopeMapId This property is required. String
The ID of the Container Registry Scope Map associated with the token.
enabled Boolean
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. String
Specifies the name of the token. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the RegistryToken resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RegistryToken Resource

Get an existing RegistryToken resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RegistryTokenState, opts?: CustomResourceOptions): RegistryToken
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        container_registry_name: Optional[str] = None,
        enabled: Optional[bool] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        scope_map_id: Optional[str] = None) -> RegistryToken
func GetRegistryToken(ctx *Context, name string, id IDInput, state *RegistryTokenState, opts ...ResourceOption) (*RegistryToken, error)
public static RegistryToken Get(string name, Input<string> id, RegistryTokenState? state, CustomResourceOptions? opts = null)
public static RegistryToken get(String name, Output<String> id, RegistryTokenState state, CustomResourceOptions options)
resources:  _:    type: azure:containerservice:RegistryToken    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ContainerRegistryName Changes to this property will trigger replacement. string
The name of the Container Registry. Changing this forces a new resource to be created.
Enabled bool
Should the Container Registry token be enabled? Defaults to true.
Name Changes to this property will trigger replacement. string
Specifies the name of the token. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
ScopeMapId string
The ID of the Container Registry Scope Map associated with the token.
ContainerRegistryName Changes to this property will trigger replacement. string
The name of the Container Registry. Changing this forces a new resource to be created.
Enabled bool
Should the Container Registry token be enabled? Defaults to true.
Name Changes to this property will trigger replacement. string
Specifies the name of the token. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
ScopeMapId string
The ID of the Container Registry Scope Map associated with the token.
containerRegistryName Changes to this property will trigger replacement. String
The name of the Container Registry. Changing this forces a new resource to be created.
enabled Boolean
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. String
Specifies the name of the token. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scopeMapId String
The ID of the Container Registry Scope Map associated with the token.
containerRegistryName Changes to this property will trigger replacement. string
The name of the Container Registry. Changing this forces a new resource to be created.
enabled boolean
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. string
Specifies the name of the token. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scopeMapId string
The ID of the Container Registry Scope Map associated with the token.
container_registry_name Changes to this property will trigger replacement. str
The name of the Container Registry. Changing this forces a new resource to be created.
enabled bool
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. str
Specifies the name of the token. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scope_map_id str
The ID of the Container Registry Scope Map associated with the token.
containerRegistryName Changes to this property will trigger replacement. String
The name of the Container Registry. Changing this forces a new resource to be created.
enabled Boolean
Should the Container Registry token be enabled? Defaults to true.
name Changes to this property will trigger replacement. String
Specifies the name of the token. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the Container Registry token. Changing this forces a new resource to be created.
scopeMapId String
The ID of the Container Registry Scope Map associated with the token.

Import

Container Registries can be imported using the resource id, e.g.

$ pulumi import azure:containerservice/registryToken:RegistryToken example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ContainerRegistry/registries/myregistry1/tokens/token1
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.