Skip to content

Commit

Permalink
skip managed hsm auth build if not specified like in cn env
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxu92 committed Jul 7, 2023
1 parent c8d1a23 commit 47cafb3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/clients/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ func Build(ctx context.Context, builder ClientBuilder) (*Client, error) {
return nil, fmt.Errorf("building account: %+v", err)
}

managedHSMAuth, err := auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.ManagedHSM)
if err != nil {
return nil, fmt.Errorf("unable to build authorizer for Managed HSM API: %+v", err)
var managedHSMAuth auth.Authorizer
if _, ok := builder.AuthConfig.Environment.ManagedHSM.ResourceIdentifier(); ok {
managedHSMAuth, err = auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.ManagedHSM)
if err != nil {
return nil, fmt.Errorf("unable to build authorizer for Managed HSM API: %+v", err)
}
} else {
log.Printf("[DEBUG] Skipping building the Managed HSM Authorizer since this is not supported in the current Azure Environment")
}

client := Client{
Expand Down

0 comments on commit 47cafb3

Please sign in to comment.