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).
Description of the new feature
New-AzContainerRegistryCredentials
(https://learn.microsoft.com/en-us/powershell/module/az.containerregistry/new-azcontainerregistrycredentials) requires the parametertokenId
. 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