You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// the errors from adal contains \r\n in the body, get rid of them to make the error easier to look at
@@ -65,16 +67,19 @@ func init() {
65
67
66
68
lgCmd.PersistentFlags().StringVar(&loginCmdArg.tenantID, "tenant-id", "", "The Azure Active Directory tenant ID to use for OAuth device interactive login.")
67
69
lgCmd.PersistentFlags().StringVar(&loginCmdArg.aadEndpoint, "aad-endpoint", "", "The Azure Active Directory endpoint to use. The default ("+common.DefaultActiveDirectoryEndpoint+") is correct for the public Azure cloud. Set this parameter when authenticating in a national cloud. Not needed for Managed Service Identity")
68
-
// Use identity which aligns to Azure powershell and CLI.
69
-
lgCmd.PersistentFlags().BoolVar(&loginCmdArg.identity, "identity", false, "Log in using virtual machine's identity, also known as managed service identity (MSI).")
70
-
// Use SPN certificate to log in.
71
-
lgCmd.PersistentFlags().BoolVar(&loginCmdArg.servicePrincipal, "service-principal", false, "Log in via Service Principal Name (SPN) by using a certificate or a secret. The client secret or certificate password must be placed in the appropriate environment variable. Type AzCopy env to see names and descriptions of environment variables.")
72
-
// Client ID of user-assigned identity.
70
+
71
+
lgCmd.PersistentFlags().BoolVar(&loginCmdArg.identity, "identity", false, "Deprecated. Please use --login-type=MSI. Log in using virtual machine's identity, also known as managed service identity (MSI).")
72
+
lgCmd.PersistentFlags().BoolVar(&loginCmdArg.servicePrincipal, "service-principal", false, "Deprecated. Please use --login-type=SPN. Log in via Service Principal Name (SPN) by using a certificate or a secret. The client secret or certificate password must be placed in the appropriate environment variable. Type AzCopy env to see names and descriptions of environment variables.")
73
+
// Deprecate these flags in favor of a new login type flag
lgCmd.PersistentFlags().StringVar(&loginCmdArg.loginType, "login-type", common.EAutoLoginType.Device().String(), "Default value is "+common.EAutoLoginType.Device().String()+". Specify the credential type to access Azure Resource, available values are "+strings.Join(common.ValidAutoLoginTypes(), ", ")+".")
78
+
79
+
// Managed Identity flags
73
80
lgCmd.PersistentFlags().StringVar(&loginCmdArg.identityClientID, "identity-client-id", "", "Client ID of user-assigned identity.")
74
-
// Resource ID of user-assigned identity.
75
81
lgCmd.PersistentFlags().StringVar(&loginCmdArg.identityResourceID, "identity-resource-id", "", "Resource ID of user-assigned identity.")
76
-
77
-
//login with SPN
82
+
// SPN flags
78
83
lgCmd.PersistentFlags().StringVar(&loginCmdArg.applicationID, "application-id", "", "Application ID of user-assigned identity. Required for service principal auth.")
79
84
lgCmd.PersistentFlags().StringVar(&loginCmdArg.certPath, "certificate-path", "", "Path to certificate for SPN authentication. Required for certificate-based service principal auth.")
80
85
@@ -91,8 +96,8 @@ type loginCmdArgs struct {
91
96
92
97
identitybool// Whether to use MSI.
93
98
servicePrincipalbool
94
-
azCliCredbool
95
-
psCredbool
99
+
100
+
loginTypestring
96
101
97
102
// Info of VM's user assigned identity, client or object ids of the service identity are required if
98
103
// your VM has multiple user-assigned managed identities.
@@ -109,75 +114,39 @@ type loginCmdArgs struct {
109
114
persistTokenbool
110
115
}
111
116
112
-
func (lcaloginCmdArgs) validate() error {
113
-
// Only support one kind of oauth login at same time.
114
-
switch {
115
-
caselca.identity:
116
-
iflca.servicePrincipal {
117
-
returnerrors.New("you can only log in with one type of auth at once")
118
-
}
119
-
120
-
// Consider only command-line parameters as env vars are a hassle to change and it's not like we'll use them here.
returnerrors.New("identity client/object/resource ID are exclusive to managed service identity auth and are not compatible with service principal auth")
returnerrors.New("identity client/object/resource IDs are exclusive to managed service identity auth and are not compatible with OAuth")
149
-
}
150
-
}
151
-
152
-
returnnil
153
-
}
154
-
155
117
func (lcaloginCmdArgs) process() error {
156
-
// Validate login parameters.
157
-
iferr:=lca.validate(); err!=nil {
158
-
returnerr
118
+
// Login type consolidation to allow backward compatibility.
119
+
iflca.servicePrincipal||lca.identity {
120
+
glcm.Warn("The flags --service-principal and --identity will be deprecated in a future release. Please use --login-type=SPN or --login-type=MSI instead.")
func (AutoLoginType) TokenStore() AutoLoginType { returnAutoLoginType(255) } // Storage Explorer internal integration only. Do not add this to ValidAutoLoginTypes.
Description: "Specify the credential type to access Azure Resource without invoking the login command and using the OS secret store, available values SPN, MSI, DEVICE, AZCLI, and PSCRED - sequentially for Service Principal, Managed Service Identity, Device workflow, Azure CLI, or Azure PowerShell.",
132
+
Description: "Specify the credential type to access Azure Resource without invoking the login command and using the OS secret store, available values are "+strings.Join(ValidAutoLoginTypes(), ", ") +".",
0 commit comments