Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AzCLI instead of client secret creds #2906

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion e2etest/newe2e_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type NewE2EConfig struct {
StaticOAuth struct {
wonwuakpa-msft marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this could be done as an either/or setup

weigh this with a grain of salt, most of the team will probably do inherited auth

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on a similar note, could it be set up to allow AzCLI or AzPwsh inheritance? Some people on the team use one or the other, not usually both

TenantID string `env:"NEW_E2E_STATIC_TENANT_ID"`
ApplicationID string `env:"NEW_E2E_STATIC_APPLICATION_ID,required"`
wonwuakpa-msft marked this conversation as resolved.
Show resolved Hide resolved
ClientSecret string `env:"NEW_E2E_STATIC_CLIENT_SECRET,required"`
ClientSecret string `env:"NEW_E2E_STATIC_CLIENT_SECRET"`
}

// todo: should we automate this somehow? Currently each of these accounts needs some marginal boilerplate.
Expand Down
4 changes: 2 additions & 2 deletions e2etest/newe2e_oauth_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func SetupOAuthCache(a Asserter) {
tenantId = common.Iff(useStatic, staticLoginInfo.TenantID, dynamicLoginInfo.DynamicOAuth.SPNSecret.TenantID)
cred, err = azidentity.NewClientSecretCredential(
wonwuakpa-msft marked this conversation as resolved.
Show resolved Hide resolved
tenantId,
common.Iff(useStatic, staticLoginInfo.ApplicationID, dynamicLoginInfo.DynamicOAuth.SPNSecret.ApplicationID),
common.Iff(useStatic, staticLoginInfo.ClientSecret, dynamicLoginInfo.DynamicOAuth.SPNSecret.ClientSecret),
dynamicLoginInfo.DynamicOAuth.SPNSecret.ApplicationID, //Only use the dynamic info would be used
dynamicLoginInfo.DynamicOAuth.SPNSecret.ClientSecret,
nil, // Hopefully the defaults should be OK?
)
}
Expand Down
5 changes: 1 addition & 4 deletions e2etest/newe2e_task_runazcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,9 @@ func (c *AzCopyCommand) applyTargetAuth(a Asserter, target ResourceManager) stri

if c.Environment.AutoLoginMode == nil && c.Environment.ServicePrincipalAppID == nil && c.Environment.ServicePrincipalClientSecret == nil && c.Environment.AutoLoginTenantID == nil {
if GlobalConfig.StaticResources() {
c.Environment.AutoLoginMode = pointerTo("SPN")
c.Environment.AutoLoginMode = pointerTo(common.EAutoLoginType.AzCLI().String())
oAuthInfo := GlobalConfig.E2EAuthConfig.StaticStgAcctInfo.StaticOAuth
a.AssertNow("At least NEW_E2E_STATIC_APPLICATION_ID and NEW_E2E_STATIC_CLIENT_SECRET must be specified to use OAuth.", Empty{true}, oAuthInfo.ApplicationID, oAuthInfo.ClientSecret)

c.Environment.ServicePrincipalAppID = &oAuthInfo.ApplicationID
c.Environment.ServicePrincipalClientSecret = &oAuthInfo.ClientSecret
c.Environment.AutoLoginTenantID = common.Iff(oAuthInfo.TenantID != "", &oAuthInfo.TenantID, nil)
} else {
// oauth should reliably work
Expand Down
Loading