Azure Platform Series: Creating an Azure Container Registry – ‘registry_name’ must conform to the following pattern

This is another blog post in the series of how to #MakeStuffGo in Azure.

Background:

I am working on a client project that requires containerised applications – so we will be using Azure Container Registry.

I am using bash scripts to create the resources in Azure – so am using variables for all the things.

How to #MakeStuffGo with Azure Container Registry

Initially I had a Resource Group called AKS-RG as the client wanted their resource groups to have the function of what would be in there (in this case Azure Kubernetes Services) and -RG so that it was obvious it was a resource group.

So initially the script for the Azure Container Registry was:

az acr create \
--resource-group $RESOURCE_GROUP \
--location $REGION_NAME \
--name $ACR_NAME \
--sku Standard

Where I had the variables $RESOURCE_GROUP, $REGION_NAME and $ACR_NAME already defined further up in the script.

The only problem was – we had defined

ACR_NAME=acr-$RESOURCE_GROUP
which then failed in Azure Cloud Shell with:
validation error: Parameter 'registry_name' must conform to the following pattern: '^[a-zA-Z0-9]*$'.

The fix was pretty simple – we just changed ACR_NAME variable to be:

ACR_NAME=acr$CLIENTNAME

Which to be honest was a better standard – as we already had the clientname defined as a variable.

It is also the same in the UI (sometimes it is good to try this out as sometimes there are inconsistencies in Azure……)

Screen Shot 2020-06-07 at 17.54.22

So there you go – in some places you can use dashes in Azure and in some places you cannot. But that’s why we have prototypes – to find out all this fun stuff that keeps us on our toes..

 

Yip.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s