Not able to create secrete in Azure Key valut

Ranjitha Shetty 20 Reputation points
2023-05-24T08:11:55.5166667+00:00

User's image

I am trying to create the secret in the key vault from C sharp console application. But I am getting the below error in the code.

KeyVaultErrorException: Operation returned an invalid status code 'NotFound'.

If I try to create in Azure I am getting an error as in the attachment.

Please help me to resolve this issue and create and update the secret in key vault from Console application.

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,451 questions
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,911 Reputation points Microsoft Employee Moderator
    2023-05-25T18:46:40.32+00:00

    @Ranjitha Shetty

    Thank you for your post!

    Error Message:

    The operation is not allowed by RBAC. If role assignments were recently changed, please wait several minutes for role assignments to become effective.

    I understand that you're trying to create a Key Vault Secret from your C# console app, and when trying to create the Secret within the Portal you're running into the error above. In order to resolve your issue from the Portal, you'll have to ensure that your user has the correct Key Vault RBAC permissions to create the Key Vault Secret.

    Key Vault RBAC Permissions:

    1. Go to your Key Vault or the Resource Group that contains your vault.
    2. Select Access control (IAM).
    3. Select View my access. You can also select the Role assignments tab to find your user's KV permissions.
    4. Ensure you have the Key Vault Secrets Officer or Key Vault Administrator role assigned to your user.

    For more info - Azure built-in roles for Key Vault data plane operationsUser's image

    Please note that it will take up to 10 minutes (600 seconds) after role assignments is changed for role to be applied. For more info.


    Error:

    KeyVaultErrorException: Operation returned an invalid status code 'NotFound'.

    To hopefully help troubleshoot your C# Console app error, it looks like your error message is referring to the specified resource not being found. For more info - Common error codes for Azure Key Vault. To gain a better understanding of your console app, can you share the documentation you followed to set this up?

    Additional Link:

    I hope this helps!

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


    If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.