Deleting Azure SWA named environment getting AuthorizationFailed but removes.

Per Kortbek Jørgensen 0 Reputation points

I am have a pipeline, were we are running some security scanning.

We first deploy the site to SWA named environments, then run the scan and removes the site (Using 'az staticwebapp environment delete').

It removes the site, but the task returns following:

ERROR: (AuthorizationFailed) The client 'xxxxxx' with object id 'xxxxxx' does not have authorization to perform action 'Microsoft.Web/locations/operationResults/read' over scope '/subscriptions/***/providers/Microsoft.Web/locations/westeurope/operationResults/xxxxx' or the scope is invalid. If access was recently granted, please refresh your credentials.

Code: AuthorizationFailed

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
838 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 24,566 Reputation points Microsoft Employee

    Firstly, apologies for the delayed response.

    I understand you’re encountering an “AuthorizationFailed” error when deleting an Azure Static Web Apps (SWA) named environment, however the site is removed.

    Typically, the error message indicates that the client lacks authorization to perform the specified action over a particular scope.

    You may review that the service principal or user account you’re using has the necessary permissions to delete the named environment. Specifically, verify that it has the required permissions for the Microsoft.Web/locations/operationResults/read action.

    If you’re using a service principal, consider regenerating its credentials or obtaining a new access token.

    Just to highlight the specific diff in cmdlets:

    az staticwebapp environment delete -Delete the static app production environment or the specified environment.

    az staticwebapp delete - Delete a static app.

    Kindly let us know, I'll follow-up with you further.

    0 comments No comments