Get-CmAzResourceName

Generates a name for a resource based on predefined naming conventions.

Returns a message, validating that the package has been correctly installed.

This command is part of the common command tooling.

Parameters

-Resource

Required. (String) The type of the resource.

-Architecture

Required. (String) Infrastructure the resource is used for.

-Region

Required. (String) Where the resource will be located.

-Name

Required. (String) Custom value to provide contextual value to the resource.

-SubscriptionName

Required. (String) Name of the subscription the resource will be deployed in, defaults to the current subscription in the azcontext.

-IncludeBuild

Required. (SwitchParameter) For VM and VMscalesets replaces hash with build ID. For all other resources appends build id to hash.

-MaxLength

Required. (Int32) Max length of the name to be generated.

Examples

Example 1

1
2
3
4
    Get-CmAzResourceName -Resource "ResourceGroup" -Architecture "Core" -Region "UK South" -Name "DocsWebsite"
Output: rg-docswebsite-core-97547bfe
    
  

Example 2

1
2
3
4
    Get-CmAzResourceName -Resource "VirtualMachine" -Architecture "Core" -Region "UK South" -Name "NewWebsite" -IncludeBuild
Output: rg-newwebsite-core-2a04bdf4-001
    
  

Example 3

1
2
3
4
    Get-CmAzResourceName -Resource "VirtualMachine" -Architecture "Core" -Region "UK South" -Name "mywindows" -IncludeBuild
Output: vmmywindows001
    
  

Example 4

1
2
3
4
    Get-CmAzResourceName -Resource "VirtualMachine" -Architecture "Core" -Region "UK South" -Name "mywindows"
Output: vmmywindowsa941