Interactive and command-line sign in methods work with -tenant. domain or the Azure object ID for the tenant. The value of this argument can either be an. You can select a tenant to sign in under with the -tenant argument. read -sp "Azure password: " AZ_PASS & echo & az login -service-principal -u -p $AZ_PASS -tenant Īz login -service-principal -u $AzCred.UserName -p $AzCred.GetNetworkCredential().Password -tenant The tenant associated with the service principal, as either an.The service principal password, or the X509 certificate used to create the service principal in PEM format.The URL or name associated with the service principal.To sign in with a service principal, you need: To learn moreĪbout service principals, see Create an Azure service principal with the Azure CLI. Authenticating with a service principal is the best way to write secure scripts or programs,Īllowing you to apply both permissions restrictions and locally stored static credential information. Service principals are accounts not tied to any particular user, which can have permissions on them assigned through $AzCred = Get-Credential -UserName Īz login -u $AzCred.UserName -p $AzCred.GetNetworkCredential().Password Under PowerShell, use the Get-Credential cmdlet. read -sp "Azure password: " AZ_PASS & echo & az login -u -p $AZ_PASS If you want to avoid displaying your password on console and are using az login interactively, If you have multiple subscriptions, you can change your default subscription. You get a message from the CLI saying you need to login again.Īfter signing in, CLI commands are run against your default subscription. As of August 2018 this token is revoked after 90 days of inactivity, but this value can be changed by Microsoft or your tenant administrator. None of your login information is stored by Azure CLI. By granting just the appropriate permissions needed to a service principal, you can keep your automation secure. When writing scripts, the recommended approach is Locally, you can sign in interactively through your browser with the az login command. There are several authentication types for the Azure Command-Line Interface (CLI), so how do you log in? The easiest way to get started is with Azure Cloud Shell, which automatically logs you in.
0 Comments
Leave a Reply. |