Registries - Generate Credentials

Generate keys for a token of a specified container registry.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials?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 Type Description
expiry

string

The expiry date of the generated credentials after which the credentials become invalid.

name

TokenPasswordName

Specifies name of the password which should be regenerated if any -- password1 or password2.

tokenId

string

The resource ID of the token for which credentials have to be generated.

Responses

Name Type Description
200 OK

GenerateCredentialsResult

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

202 Accepted

The request was successful; the operation will complete asynchronously.

Headers

Location: string

Other Status Codes

ErrorResponse

Error response describing why the operation failed. If the resource does not exist, 404 (Not found) 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

RegistryGenerateCredentials

Sample Request

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

{
  "tokenId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken",
  "expiry": "2020-12-31T15:59:59.0707808Z"
}

Sample Response

{
  "username": "myToken",
  "passwords": [
    {
      "expiry": "2020-12-31T15:59:59.0707808Z",
      "name": "password1",
      "value": "00000000000000000000000000000000"
    },
    {
      "expiry": "2020-12-31T15:59:59.0707808Z",
      "name": "password2",
      "value": "00000000000000000000000000000000"
    }
  ]
}
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/operationStatuses/registries-00000000-0000-0000-0000-000000000000?api-version=2023-01-01-preview

Definitions

Name Description
ErrorResponse

An error response from the Azure Container Registry service.

ErrorResponseBody

An error response from the Azure Container Registry service.

GenerateCredentialsParameters

The parameters used to generate credentials for a specified token or user of a container registry.

GenerateCredentialsResult

The response from the GenerateCredentials operation.

InnerErrorDescription

inner error.

TokenPassword

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

TokenPasswordName

The password name "password1" or "password2"

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.

GenerateCredentialsParameters

The parameters used to generate credentials for a specified token or user of a container registry.

Name Type Description
expiry

string

The expiry date of the generated credentials after which the credentials become invalid.

name

TokenPasswordName

Specifies name of the password which should be regenerated if any -- password1 or password2.

tokenId

string

The resource ID of the token for which credentials have to be generated.

GenerateCredentialsResult

The response from the GenerateCredentials operation.

Name Type Description
passwords

TokenPassword[]

The list of passwords for a container registry.

username

string

The username for a container registry.

InnerErrorDescription

inner error.

Name Type Description
code

string

error code.

message

string

error message.

target

string

target of the particular error.

TokenPassword

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

Name Type Description
creationTime

string

The creation datetime of the password.

expiry

string

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"

Name Type Description
password1

string

password2

string