Share via


Tokens - Create

Creates a token for a container registry with the specified parameters.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}?api-version=2023-01-01-preview

URI Parameters

Name In Required Type Description
registryName
path True

string

minLength: 5
maxLength: 50
pattern: ^[a-zA-Z0-9]*$

The name of the container registry.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

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.

tokenName
path True

string

minLength: 5
maxLength: 50
pattern: ^[a-zA-Z0-9-]*$

The name of the token.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Type Description
properties.credentials

TokenCredentialsProperties

The credentials that can be used for authenticating the token.

properties.scopeMapId

string

The resource ID of the scope map to which the token will be associated with.

properties.status

TokenStatus

The status of the token example enabled or disabled.

Responses

Name Type Description
200 OK

Token

The request was successful; the request was well-formed and received properly.

201 Created

Token

The request was successful; the operation will complete asynchronously.

Headers

Azure-AsyncOperation: string

Other Status Codes

ErrorResponse

Error response describing why the operation failed. If any of the input parameters are invalid, 400 (Bad Request) is returned. If the request cannot be processed due to a conflict in the request, 409 (Conflict) is returned.

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

TokenCreate

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken?api-version=2023-01-01-preview

{
  "properties": {
    "scopeMapId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap",
    "status": "disabled",
    "credentials": {
      "certificates": [
        {
          "name": "certificate1",
          "encodedPemCertificate": "LS0tLS1CRUdJTiB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hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="
        }
      ]
    }
  }
}

Sample response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken",
  "name": "myToken",
  "type": "Microsoft.ContainerRegistry/registries/tokens",
  "properties": {
    "creationDate": "2017-03-01T23:14:37.0707808Z",
    "scopeMapId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap",
    "provisioningState": "Succeeded",
    "status": "disabled",
    "credentials": {
      "certificates": [
        {
          "name": "certificate1",
          "thumbprint": "feeb79a888bf1415f8e17c4965a2a5bb5c8a2ff7",
          "expiry": "2020-12-04T15:32:48.0707808Z"
        }
      ]
    }
  }
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken/operationStatuses/tokens-00000000-0000-0000-0000-000000000000?api-version=2023-01-01-preview
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken",
  "name": "myToken",
  "type": "Microsoft.ContainerRegistry/registries/tokens",
  "properties": {
    "creationDate": "2017-03-01T23:14:37.0707808Z",
    "scopeMapId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap",
    "provisioningState": "Succeeded",
    "status": "disabled",
    "credentials": {
      "certificates": [
        {
          "name": "certificate1",
          "thumbprint": "feeb79a888bf1415f8e17c4965a2a5bb5c8a2ff7",
          "expiry": "2020-12-04T15:32:48.0707808Z"
        }
      ]
    }
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

ErrorResponse

An error response from the Azure Container Registry service.

ErrorResponseBody

An error response from the Azure Container Registry service.

InnerErrorDescription

inner error.

lastModifiedByType

The type of identity that last modified the resource.

ProvisioningState

Provisioning state of the resource.

SystemData

Metadata pertaining to creation and last modification of the resource.

Token

An object that represents a token for a container registry.

TokenCertificate

The properties of a certificate used for authenticating a token.

TokenCertificateName
TokenCredentialsProperties

The properties of the credentials that can be used for authenticating the token.

TokenPassword

The password that will be used for authenticating the token of a container registry.

TokenPasswordName

The password name "password1" or "password2"

TokenStatus

The status of the token example enabled or disabled.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

ErrorResponse

An error response from the Azure Container Registry service.

Name Type Description
error

ErrorResponseBody

Azure container registry build API error body.

ErrorResponseBody

An error response from the Azure Container Registry service.

Name Type Description
code

string

error code.

details

InnerErrorDescription[]

an array of additional nested error response info objects, as described by this contract.

message

string

error message.

target

string

target of the particular error.

InnerErrorDescription

inner error.

Name Type Description
code

string

error code.

message

string

error message.

target

string

target of the particular error.

lastModifiedByType

The type of identity that last modified the resource.

Value Description
User
Application
ManagedIdentity
Key

ProvisioningState

Provisioning state of the resource.

Value Description
Creating
Updating
Deleting
Succeeded
Failed
Canceled

SystemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource modification (UTC).

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

lastModifiedByType

The type of identity that last modified the resource.

Token

An object that represents a token for a container registry.

Name Type Description
id

string

The resource ID.

name

string

The name of the resource.

properties.creationDate

string (date-time)

The creation date of scope map.

properties.credentials

TokenCredentialsProperties

The credentials that can be used for authenticating the token.

properties.provisioningState

ProvisioningState

Provisioning state of the resource.

properties.scopeMapId

string

The resource ID of the scope map to which the token will be associated with.

properties.status

TokenStatus

The status of the token example enabled or disabled.

systemData

SystemData

Metadata pertaining to creation and last modification of the resource.

type

string

The type of the resource.

TokenCertificate

The properties of a certificate used for authenticating a token.

Name Type Description
encodedPemCertificate

string

Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token.

expiry

string (date-time)

The expiry datetime of the certificate.

name

TokenCertificateName

thumbprint

string

The thumbprint of the certificate.

TokenCertificateName

Value Description
certificate1
certificate2

TokenCredentialsProperties

The properties of the credentials that can be used for authenticating the token.

Name Type Description
certificates

TokenCertificate[]

The properties of a certificate used for authenticating a token.

passwords

TokenPassword[]

The password that will be used for authenticating the token of a container registry.

TokenPassword

The password that will be used for authenticating the token of a container registry.

Name Type Description
creationTime

string (date-time)

The creation datetime of the password.

expiry

string (date-time)

The expiry datetime of the password.

name

TokenPasswordName

The password name "password1" or "password2"

value

string

The password value.

TokenPasswordName

The password name "password1" or "password2"

Value Description
password1
password2

TokenStatus

The status of the token example enabled or disabled.

Value Description
enabled
disabled