Skip to content

Getting started Check NamePrefix availability

CARMLPipelinePrincipal edited this page Aug 29, 2022 · 6 revisions

The 'Test-NamePrefixAvailability' function provides you with the capability to test if the namePrefix, specified in the settings.yml file, conflicts with any existing resource.


Navigation


Location

You can find the script under utilities/tools/Test-NamePrefixAvailability.ps1.

How it works

When invoked, the script

  1. Fetches all module test files for modules that require unique names. For example
    • 'Microsoft.Storage/storageAccounts'
    • 'Microsoft.ContainerRegistry/registries'
    • 'Microsoft.KeyVault/vaults'
  2. Replace any tokens contained in the module test files with the key-value pairs provided in the Tokens input parameter.
  3. Search for each resource resource type if the final name would be taken.
  4. Return the result for each resource alongside a final recommendation to use / not use the chosen 'namePrefix'.

How to use it

Note: You'll need to have an active Azure login. If not connected, you can do so via the Connect-AzAccount cmdlet (from the Az.Resources PowerShell module).

Note: The script must be loaded ('dot-sourced') before the function can be invoked.

For details on how to use the function, please refer to the script's local documentation.

Clone this wiki locally