'How to create GUID for multiple resources in Azure ARM template?

I am currently generating ARM template for Log analytics workspace saved search,Here Each query have a unique GUID,But I can generate a single unique GUID in the parameter.But I Want multiple GUID to assign to each query.Is there is any to generate multiple GUID inside ARM Template?



Solution 1:[1]

You can generate them using guid() ARM Template function (https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-string?tabs=json#guid).

Solution 2:[2]

This is how I did it, { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "Utc": { "type": "string", "defaultValue": "[utcNow('u')]", "metadata": { "description": "This is not an optional parameter, please do not pass a new datetime" } } }, "variables": { "user": { "user-name": "Test Person" } }, "resources": [], "outputs": { "guid1": { "type": "string", "value": "[guid(concat(parameters('Utc'), '1'))]" }, "guid2": { "type": "string", "value": "[guid(concat(parameters('Utc'), '2'))]" } } }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kamil Wiecek
Solution 2 Captain_Slow