Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
wbreza committed Jul 26, 2023
1 parent 3e280d6 commit 4999999
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 3 additions & 1 deletion cli/azd/pkg/pipeline/pipeline_manager.go
Expand Up @@ -149,7 +149,9 @@ func (pm *PipelineManager) Configure(ctx context.Context) (result *PipelineConfi

if pm.args.PipelineServicePrincipalName != "" && pm.args.PipelineServicePrincipalId != "" {
//nolint:lll
return result, fmt.Errorf("you have specified both --principal-id and --principal-name, but only one of these parameters should be used at a time.")
return result, fmt.Errorf(
"you have specified both --principal-id and --principal-name, but only one of these parameters should be used at a time.",
)
}

// Existing Service Principal Lookup strategy
Expand Down
9 changes: 3 additions & 6 deletions cli/azd/pkg/tools/azcli/ad.go
Expand Up @@ -32,16 +32,15 @@ type AzureCredentials struct {
type ErrorWithSuggestion struct {
Suggestion string
Err error

// AdService provides actions on top of Azure Active Directory (AD)
type AdService interface {
GetServicePrincipal(
}

func (es *ErrorWithSuggestion) Error() string {
return es.Err.Error()
}

// AdService provides actions on top of Azure Active Directory (AD)
type AdService interface {
GetServicePrincipal(
ctx context.Context,
subscriptionId string,
applicationId string,
Expand Down Expand Up @@ -371,14 +370,12 @@ func (ad *adService) applyRoleAssignmentWithRetry(

// If the response is a 403 then the required role is missing.
if errors.As(err, &responseError) && responseError.StatusCode == http.StatusForbidden {

return &ErrorWithSuggestion{
Suggestion: fmt.Sprintf("\nSuggested Action: Ensure you have either the `User Access Administrator`, " +
"Owner` or custom azure roles assigned to your subscription to perform action " +
"'Microsoft.Authorization/roleAssignments/write', in order to manage role assignments\n"),
Err: err,
}

}

return retry.RetryableError(
Expand Down

0 comments on commit 4999999

Please sign in to comment.