Webhooks - Create

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

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}?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.

webhookName
path True

string

The name of the webhook.

Regex pattern: ^[a-zA-Z0-9]*$

api-version
query True

string

The API version to use for this operation.

Request Body

Name Required Type Description
location True

string

The location of the webhook. This cannot be changed after the resource is created.

properties.actions True

WebhookAction[]

The list of actions that trigger the webhook to post notifications.

properties.serviceUri True

string

The service URI for the webhook to post notifications.

properties.customHeaders

object

Custom headers that will be added to the webhook notifications.

properties.scope

string

The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events.

properties.status

WebhookStatus

The status of the webhook at the time the operation was called.

tags

object

The tags for the webhook.

Responses

Name Type Description
200 OK

Webhook

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

201 Created

Webhook

The request was successful; the operation will complete asynchronously.

Headers

Azure-AsyncOperation: 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

WebhookCreate

Sample Request

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

{
  "location": "westus",
  "tags": {
    "key": "value"
  },
  "properties": {
    "serviceUri": "http://myservice.com",
    "customHeaders": {
      "Authorization": "******"
    },
    "status": "enabled",
    "scope": "myRepository",
    "actions": [
      "push"
    ]
  }
}

Sample Response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/webhooks/myWebhook",
  "name": "myWebhook",
  "type": "Microsoft.ContainerRegistry/registries/webhooks",
  "location": "westus",
  "tags": {
    "key": "value"
  },
  "properties": {
    "status": "enabled",
    "scope": "myRepository",
    "actions": [
      "push"
    ],
    "provisioningState": "Succeeded"
  }
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/webhooks/myWebhook/operationStatuses/webhooks-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/webhooks/myWebhook",
  "name": "myWebhook",
  "type": "Microsoft.ContainerRegistry/registries/webhooks",
  "location": "westus",
  "tags": {
    "key": "value"
  },
  "properties": {
    "status": "enabled",
    "scope": "myRepository",
    "actions": [
      "push"
    ],
    "provisioningState": "Creating"
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

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.

Webhook

An object that represents a webhook for a container registry.

WebhookAction

The list of actions that trigger the webhook to post notifications.

WebhookCreateParameters

The parameters for creating a webhook.

WebhookStatus

The status of the webhook at the time the operation was called.

createdByType

The type of identity that created the resource.

Name Type Description
Application

string

Key

string

ManagedIdentity

string

User

string

lastModifiedByType

The type of identity that last modified the resource.

Name Type Description
Application

string

Key

string

ManagedIdentity

string

User

string

ProvisioningState

Provisioning state of the resource.

Name Type Description
Canceled

string

Creating

string

Deleting

string

Failed

string

Succeeded

string

Updating

string

SystemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string

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

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.

Webhook

An object that represents a webhook for a container registry.

Name Type Description
id

string

The resource ID.

location

string

The location of the resource. This cannot be changed after the resource is created.

name

string

The name of the resource.

properties.actions

WebhookAction[]

The list of actions that trigger the webhook to post notifications.

properties.provisioningState

ProvisioningState

The provisioning state of the webhook at the time the operation was called.

properties.scope

string

The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events.

properties.status

WebhookStatus

The status of the webhook at the time the operation was called.

systemData

SystemData

Metadata pertaining to creation and last modification of the resource.

tags

object

The tags of the resource.

type

string

The type of the resource.

WebhookAction

The list of actions that trigger the webhook to post notifications.

Name Type Description
chart_delete

string

chart_push

string

delete

string

push

string

quarantine

string

WebhookCreateParameters

The parameters for creating a webhook.

Name Type Description
location

string

The location of the webhook. This cannot be changed after the resource is created.

properties.actions

WebhookAction[]

The list of actions that trigger the webhook to post notifications.

properties.customHeaders

object

Custom headers that will be added to the webhook notifications.

properties.scope

string

The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events.

properties.serviceUri

string

The service URI for the webhook to post notifications.

properties.status

WebhookStatus

The status of the webhook at the time the operation was called.

tags

object

The tags for the webhook.

WebhookStatus

The status of the webhook at the time the operation was called.

Name Type Description
disabled

string

enabled

string