How to fix error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name?

Alexandra T 35 Reputation points
2024-07-16T11:26:30.74+00:00

I'm getting the following error:

##[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'tailspin-space-game-web-dev-25097'. Error: The client 'e795ad1c-bc56-4dbd-9ed6-5846d70f65b3' with object id 'e795ad1c-bc56-4dbd-9ed6-5846d70f65b3' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resources/read' over scope '/subscriptions/0319be96-78c5-493b-b557-3eb85b789a38' or the scope is invalid. If access was recently granted, please refresh your credentials. (CODE: 403)

when trying to go through this exercise and run the build to deploy to dev.

I already have the following role assignments but the issue is persisting. User's image

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,566 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,576 questions
0 comments No comments
{count} vote

Accepted answer
  1. akinbade abiola 8,705 Reputation points
    2024-07-16T14:23:09.4833333+00:00

    Hello Alexandra T,

    I am glad you resolved the issue.

    Due to the Community policy of users being unable to accept their own answers , I will be reposting your answer so you can accept and it will be visible to other community users.

    ISSUE:

    ##[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'tailspin-space-game-web-dev-25097'. Error: The client 'e795ad1c-bc56-4dbd-9ed6-5846d70f65b3' with object id 'e795ad1c-bc56-4dbd-9ed6-5846d70f65b3' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resources/read' over scope '/subscriptions/0319be96-78c5-493b-b557-3eb85b789a38' or the scope is invalid. If access was recently granted, please refresh your credentials. (CODE: 403)

    ANSWER:

    Alexandra T answered:

    "After trying multiple solutions, I managed to make it work by following the first answer from here"

    You can mark it 'Accept Answer' and 'Upvote' if this helped you

    Regards,

    Abiola

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Alexandra T 35 Reputation points
    2024-07-16T12:34:34.08+00:00

    After trying multiple solutions, I managed to make it work by following the first answer from here

    1 person found this answer helpful.
    0 comments No comments

  2. akinbade abiola 8,705 Reputation points
    2024-07-16T14:18:33.8066667+00:00

    Hello Alexandra T,

    Thanks for your question.

    This typically means that the service principal or managed identity running the deployment does not have sufficient permissions to access the resource.

    Try the command below to list the roles assigned. You need tat least the Contributor role at the subscription/RG scope

    az role assignment list --assignee e795ad1c-bc56-4dbd-9ed6-5846d70f65b3
    

    If the above does not have the assigned role, then assign.

    az role assignment create --assignee e795ad1c-bc56-4dbd-9ed6-5846d70f65b3 --role Contributor --scope /subscriptions/0319be96-78c5-493b-b557-3eb85b789a38
    

    See: https://learn.microsoft.com/en-us/cli/azure/role/assignment?view=azure-cli-latest#az-role-assignment-list

    You can mark it 'Accept Answer' and 'Upvote' if this helped you

    Regards,

    Abiola

    0 comments No comments