Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Resource Manager - Convert value to 'lower'

I was recently using ARM templates to deploy multiple resources into Azure. While deploying Storage accounts, I ran into an issue which was due to some constraints put up by Azure like

  1. Name of Storage Account should not contain upper case letters
  2. Its max length should be 24.

I want this name from the user and can handle the 2nd issue using the "maxLength" property on 'parameters'. But for lower case, there is no such property in 'parameters' also I'm unable to find any function which will convert the user entered value to lower case.

What I expect:

  1. Method to convert the user entered value in lower case.
  2. Any other method to suit my use case.

Thanks in advance.

like image 704
Surabh Shah Avatar asked Dec 18 '22 07:12

Surabh Shah


1 Answers

You should look at the string function reference of the ARM templates.

you need to create a variable (or just add those functions to the name input, like so:

"name": "[toLower(parameters('Name'))]"

or add a substring method, something like this:

"variables": {
    "storageAccountName": "[tolower(concat('sawithsse', substring(parameters('storageAccountType'), 0, 2), uniqueString(subscription().id, resourceGroup().id)))]"
},
like image 84
4c74356b41 Avatar answered Dec 31 '22 02:12

4c74356b41