Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Azure Classic

v4.28.0 published on Monday, Nov 22, 2021 by Pulumi

RegistryToken

Manages an Azure Container Registry token. Tokens are a preview feature only available in Premium SKU Container registries.

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

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleRegistry = new azure.containerservice.Registry("exampleRegistry", {
    resourceGroupName: exampleResourceGroup.name,
    location: exampleResourceGroup.location,
    sku: "Premium",
    adminEnabled: false,
    georeplicationLocations: [
        "East US",
        "West Europe",
    ],
});
const exampleRegistryScopeMap = new azure.containerservice.RegistryScopeMap("exampleRegistryScopeMap", {
    containerRegistryName: azurerm_container_registry.acr.name,
    resourceGroupName: azurerm_resource_group.rg.name,
    actions: [
        "repositories/repo1/content/read",
        "repositories/repo1/content/write",
    ],
});
const exampleRegistryToken = new azure.containerservice.RegistryToken("exampleRegistryToken", {
    containerRegistryName: azurerm_container_registry.acr.name,
    resourceGroupName: azurerm_resource_group.rg.name,
    scopeMapId: azurerm_container_registry_scope_map.map.id,
});
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_registry = azure.containerservice.Registry("exampleRegistry",
    resource_group_name=example_resource_group.name,
    location=example_resource_group.location,
    sku="Premium",
    admin_enabled=False,
    georeplication_locations=[
        "East US",
        "West Europe",
    ])
example_registry_scope_map = azure.containerservice.RegistryScopeMap("exampleRegistryScopeMap",
    container_registry_name=azurerm_container_registry["acr"]["name"],
    resource_group_name=azurerm_resource_group["rg"]["name"],
    actions=[
        "repositories/repo1/content/read",
        "repositories/repo1/content/write",
    ])
example_registry_token = azure.containerservice.RegistryToken("exampleRegistryToken",
    container_registry_name=azurerm_container_registry["acr"]["name"],
    resource_group_name=azurerm_resource_group["rg"]["name"],
    scope_map_id=azurerm_container_registry_scope_map["map"]["id"])
using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var exampleRegistry = new Azure.ContainerService.Registry("exampleRegistry", new Azure.ContainerService.RegistryArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
            Sku = "Premium",
            AdminEnabled = false,
            GeoreplicationLocations = 
            {
                "East US",
                "West Europe",
            },
        });
        var exampleRegistryScopeMap = new Azure.ContainerService.RegistryScopeMap("exampleRegistryScopeMap", new Azure.ContainerService.RegistryScopeMapArgs
        {
            ContainerRegistryName = azurerm_container_registry.Acr.Name,
            ResourceGroupName = azurerm_resource_group.Rg.Name,
            Actions = 
            {
                "repositories/repo1/content/read",
                "repositories/repo1/content/write",
            },
        });
        var exampleRegistryToken = new Azure.ContainerService.RegistryToken("exampleRegistryToken", new Azure.ContainerService.RegistryTokenArgs
        {
            ContainerRegistryName = azurerm_container_registry.Acr.Name,
            ResourceGroupName = azurerm_resource_group.Rg.Name,
            ScopeMapId = azurerm_container_registry_scope_map.Map.Id,
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		_, err = containerservice.NewRegistry(ctx, "exampleRegistry", &containerservice.RegistryArgs{
			ResourceGroupName: exampleResourceGroup.Name,
			Location:          exampleResourceGroup.Location,
			Sku:               pulumi.String("Premium"),
			AdminEnabled:      pulumi.Bool(false),
			GeoreplicationLocations: pulumi.StringArray{
				pulumi.String("East US"),
				pulumi.String("West Europe"),
			},
		})
		if err != nil {
			return err
		}
		_, err = containerservice.NewRegistryScopeMap(ctx, "exampleRegistryScopeMap", &containerservice.RegistryScopeMapArgs{
			ContainerRegistryName: pulumi.Any(azurerm_container_registry.Acr.Name),
			ResourceGroupName:     pulumi.Any(azurerm_resource_group.Rg.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, "exampleRegistryToken", &containerservice.RegistryTokenArgs{
			ContainerRegistryName: pulumi.Any(azurerm_container_registry.Acr.Name),
			ResourceGroupName:     pulumi.Any(azurerm_resource_group.Rg.Name),
			ScopeMapId:            pulumi.Any(azurerm_container_registry_scope_map.Map.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Create a RegistryToken Resource

new RegistryToken(name: string, args: RegistryTokenArgs, opts?: CustomResourceOptions);
@overload
def RegistryToken(resource_name: 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)
@overload
def RegistryToken(resource_name: str,
                  args: RegistryTokenArgs,
                  opts: Optional[ResourceOptions] = None)
func NewRegistryToken(ctx *Context, name string, args RegistryTokenArgs, opts ...ResourceOption) (*RegistryToken, error)
public RegistryToken(string name, RegistryTokenArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args RegistryTokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args 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 string
The unique name of the resource.
args RegistryTokenArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RegistryTokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

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

The RegistryToken resource accepts the following input properties:

ContainerRegistryName string
The name of the Container Registry. Changing this forces a new resource to be created.
ResourceGroupName 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.
Enabled bool
Should the Container Registry token be enabled? Defaults to true.
Name string
Specifies the name of the token. Changing this forces a new resource to be created.
ContainerRegistryName string
The name of the Container Registry. Changing this forces a new resource to be created.
ResourceGroupName 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.
Enabled bool
Should the Container Registry token be enabled? Defaults to true.
Name string
Specifies the name of the token. Changing this forces a new resource to be created.
containerRegistryName string
The name of the Container Registry. Changing this forces a new resource to be created.
resourceGroupName 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.
enabled boolean
Should the Container Registry token be enabled? Defaults to true.
name string
Specifies the name of the token. Changing this forces a new resource to be created.
container_registry_name str
The name of the Container Registry. Changing this forces a new resource to be created.
resource_group_name 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.
enabled bool
Should the Container Registry token be enabled? Defaults to true.
name str
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 str
The provider-assigned unique ID for this managed resource.

Look up an 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)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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 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 string
Specifies the name of the token. Changing this forces a new resource to be created.
ResourceGroupName 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 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 string
Specifies the name of the token. Changing this forces a new resource to be created.
ResourceGroupName 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 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 string
Specifies the name of the token. Changing this forces a new resource to be created.
resourceGroupName 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 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 str
Specifies the name of the token. Changing this forces a new resource to be created.
resource_group_name 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.

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

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.