Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.86k forks source link

New-AzContainerRegistryCredentials adjustments #26095

Open itpropro opened 2 months ago

itpropro commented 2 months ago

Description of the new feature

New-AzContainerRegistryCredentials (https://learn.microsoft.com/en-us/powershell/module/az.containerregistry/new-azcontainerregistrycredentials) requires the parameter tokenId. This doesn't make a lot of sense, as you are already required to provide the registry name, the resource group and eventually the subscription. It's also a lot of overhead and potential for user input errors, as you have to construct the complete resourceId on your own. This commandlet should behave the same way as the Azure CLI implementation, which only requires the name of the token (az acr token credential generate -n TOKENNAME -r REGISTRYNAME--password1).

For consistency, the commandlet should also be called New-AzContainerRegistryTokenCredential, to reflect the actual structure of the underlying API and dropping the plural form according to PowerShell naming guidelines that all other commandlets comply to (https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines?view=powershell-7.4#use-a-specific-noun-for-a-cmdlet-name-sd01).

Maybe @Nickcandy who did the initial PR for this cmdlet (thanks for that) could align it.

Proposed implementation details (optional)

New-AzContainerRegistryTokenCredential -RegistryName REGISTRYNAME -ResourceGroupName RGNAME -Name password1 -TokenName TOKENNAME

isra-fel commented 2 months ago

Thanks for reporting! @Nickcandy please look into it. Thanks