Set-AzKeyVaultSecret : Operation returned an invalid status code 'Forbidden'

Jesus Vazquez Tenorio 0 Reputation points Microsoft Vendor
2024-08-20T22:31:07.5933333+00:00

Hi!

I'm learning bicep with this https://learn.microsoft.com/en-us/training/modules/build-reusable-bicep-templates-parameters/6-exercise-create-use-parameter-files?pivots=powershell, but when i set azkeyvaultsecret commands, it resturns
Set-AzKeyVaultSecret : Operation returned an invalid status code 'Forbidden'
Code: Forbidden
Message: Caller is not authorized to perform action on resource.

And in the keyvault resource with ms learn sandbox subscription i can not review the roles.

Can anyone help me?
User's image

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,249 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Akhilesh 8,690 Reputation points Microsoft Vendor
    2024-08-23T14:04:17.8633333+00:00

    Hi @Jesus Vazquez Tenorio

    Thank you for reaching us!

    Thank you for reaching out to Microsoft Q&A forum.
    Based on the error message you shared this could be due to insufficient permissions. It appears that the Service Principal permissions are missing. If you are using Vault access policy, make sure that you have added policy for your service principal with necessary permissions under Access Policies section of your key vault. The permissions are missing from the Identity blade, and you will need to add via the Portal, for more information please review the below post, which is similar to this issue.

    https://stackoverflow.com/questions/76642169/permission-denied-invalid-permissions-on-the-specified-keyvault

    Hope this helps. Do let us know if you any further queries by responding in the comments section.

    Thanks,

    Akhilesh.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.