Awesome Reviewers expert instructions

domains / cloud-infra / Azure/azure-powershell

Follow Generated Naming

Use naming-and-identifier rules that match what AutoRest PowerShell generates, and make flag-style parameter typing consistent with the name. Apply these rules when editing custom cmdlets:

raw .md Naming Conventions Other updated

Use naming-and-identifier rules that match what AutoRest PowerShell generates, and make flag-style parameter typing consistent with the name.

Apply these rules when editing custom cmdlets: 1) AutoRest v4 model namespaces are flattened

  • Prefer Microsoft.Azure.PowerShell.Cmdlets.<Product>.Models.*.
  • Do not reference removed versioned namespaces like Microsoft.Azure.PowerShell.Cmdlets.<Product>.Models.Api<YYYYMMDD>.*.

2) Preserve AutoRest acronym casing exactly

  • Generated model type identifiers may apply lowercasing after known acronyms (example pattern: ...HCINic... may become ...Hcinic...).
  • Copy the type names from the generated Models/*.cs (or use search in generated/) rather than guessing.

3) Flag naming implies SwitchParameter

  • For parameters named like -Enable*, use [System.Management.Automation.SwitchParameter] (not [System.Boolean]).
  • This ensures the three-state behavior: presence enables, -EnableX:$false disables, and omission leaves the setting untouched—consistent with existing Az cmdlet patterns.

Example (corrected flag parameter type):

function Update-AzSomething {
  param(
    [Parameter()]
    [System.Management.Automation.SwitchParameter]$EnableSystemAssignedIdentity
  )

  if ($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) {
    $identityEnabled = [bool]$EnableSystemAssignedIdentity
    # ... apply enable/disable
  }
}
Source discussions