Connect-AzContainerRegistry
Login to an azure container registry.
Syntax
WithoutNameAndPasswordParameterSet (Default)
Connect-AzContainerRegistry
-Name <String>
[-ExposeToken]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
WithNameAndPasswordParameterSet
Connect-AzContainerRegistry
-Name <String>
-UserName <String>
-Password <String>
[-ExposeToken]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Login to an azure container registry.
Examples
Example 1
Connect-AzContainerRegistry -Name $RegistryName
Login to ACR with no credentials when already login to azure account.
Example 2
Connect-AzContainerRegistry -Name $RegistryName -UserName $RegistryName -Password $AdminPassWord
Login to ACR with admin username/password when admin user was enabled.
Example 3
Connect-AzContainerRegistry -Name $RegistryName -UserName $ServicePrincipal -Password $ServicePrincipalPassword
Login to ACR with service principal application ID and password.
Example 4
$cred = Connect-AzContainerRegistry -Name $RegistryName -ExposeToken
$token = ($cred.accessToken | ConvertFrom-SecureString -AsPlainText)
$loginServer = $cred.loginServer
docker login $loginServer -u 00000000-0000-0000-0000-000000000000 --password $token
Login to ACR with native containerize tool.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ExposeToken
Expose access token instead of automatically logging in through Docker CLI.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Name
Azure Container Registry Name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | RegistryName |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Password
Password For Azure Container Registry.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
WithNameAndPasswordParameterSet
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-UserName
User Name For Azure Container Registry.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
WithNameAndPasswordParameterSet
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
Outputs
Boolean
Notes
For plain registry names, the cmdlet uses Azure Resource Manager to discover the login server, falling back to the supplied name and environment suffix if discovery fails. Successful discovery results are reused for the same registry and context within the client.
Registry names must contain 5-50 ASCII letters or digits. An explicit login-server label may also include a single hyphen followed by a nonempty ASCII alphanumeric suffix, up to 63 characters in total. Suffixes are not restricted to a fixed length or a specific value.
Explicit hyphenated labels, including Domain Name Label (DNL) labels such as registry-<hash> and
legacy labels such as registry-microsoft, are used directly with the environment suffix, without
ARM discovery. Supply only the label, not a URL or the full login-server domain.