Azure Container Registry (ACR) - Part 3

Jorge Bernhardt
Cloud Computing
August 5, 2021

Azure Container Registry (ACR) - Part 3

Hello everyone, as I mentioned in my previous post, today I want to show you how you can use a webhook to trigger events when certain actions are performed in your Azure container registry (ACR). With this latest post in the series, we have review all the cmdlets currently available to manage an ACR using Azure PowerShell.

ACR PowerShell

Prerequisites

  • This tutorial assumes that you already have a Microsoft Azure account configured.
  • You already have an Azure Container Registry (ACR) and are properly configured. If you want to know how to create it, see this link.

Azure PowerShell Workaround

If you want to know how to install the PowerShell Azure module on your machine, check out this link.

The simplest way to get started is to sign in interactively at the command line.

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.
If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

Once you set your default subscription, you’re ready to start.

Set the variables

Here, we define the characteristics of our environment and the resource’s properties.

Creates a container registry webhook

To create a webhook using the Azure PowerShell, use the New-AzContainerRegistryWebhook cmdlet with the following syntax.

New-AzContainerRegistryWebhook

Test the Webhook

To test it, use the Test-AzContainerRegistryWebhook cmdlet with the following syntax. This command sends a generic POST request and records the response.

As you can see in the following image, the details of the events are recorded in the webhook section of your ACR.

ACR webhook

Gets all the events of a webhook

Use the Get-AzContainerRegistryWebhookEvent cmdlet to see the test results performed.

Get-AzContainerRegistryWebhookEvent

Updates a container registry webhook

If you want to make changes to the webhook configuration, you should use the Update-AzContainerRegistryWebhook cmdlet with the following syntax.

In the previous example, the delete action is added to the webhook configuration.

Update-AzContainerRegistryWebhook

Check the current configuration for a webhook

To verify the settings established in the previous step, use the Get-AzContainerRegistryWebhook cmdlet with the following syntax.

Get-AzContainerRegistryWebhook

Removes a container registry webhook

Finally, to remove a container registry webhook, you should use the Remove-AzContainerRegistryReplication cmdlet as shown below.

Thank you for reading my post. I hope you found this series of articles about Azure container registration helpful.

If you want to know more about Azure Container Registry, check out this link: https://docs.microsoft.com/en-us/azure/container-registry/

Jorge Bernhardt

Hi! I am Jorge Bernhardt and I have been an IT professional for almost 20 years. During this time, I have worked as a helpdesk operator, systems administrator, and cloud architect. I am specialised in Microsoft Technologies, particularly Microsoft Cloud & Datacenter solutions, Microsoft Virtualisation, and Microsoft 365. I love learning from other professionals and, when possible, share my knowledge back with the community.

https://www.jorgebernhardt.com

Related Posts

Newsletter BrazilClouds.com

Thank you! Your submission has been received!

Oops! Something went wrong while submitting the form