I have an Azure-hosted service which is automatically deployed (in our build process) using ARM templates, with multiple instances of the service in different resource groups. Several of the resources require globally unique names, and to support this I'm using the
uniquestring function (typically against the resource group ID) to generate part of those resource names. Names follow a templated pattern, e.g. Instance Name + Component Name + Unique String = "Example.WebAPI.abcd1234efgh5"
My problem arises later when using Powershell scripts to perform maintenance on those resources - I need the resource name, which means using the same template to generate the name from the instance, component and resource group IDs. However, there is no function in Powershell that returns the same value as the ARM
uniquestring function for the same input.
As far as I'm aware,
uniquestring is simply generating a hash of the input string and returning it as a 13-character representation; does anyone know the specifics of this hash process so it can be duplicated in Powershell, or if it has already been done?
I've looked at the answer for Can I call ARM template functions outside the JSON deployment template?, but this requires the use of output parameters in the initial ARM template and assumes the value is used immediately; whereas in my use case I need the resource name some weeks or months after the initial deploy.
powershell azure templates