How to use REST API to get Recovery Services Vault Security PIN?

Nathan Given 26 Reputation points

I'm trying to use this API to programmatically get the security pin for my recovery services vault. The endpoint is documented here:

But I'm getting this error:

    "error": {
        "code": "CloudInvalidInputError",
        "message": "The current operation failed due to an internal service error \"Invalid input error\". Please retry the operation after some time. If the issue persists, please contact Microsoft support.",
        "target": null,
        "details": null

Has anyone seen this error? My efforts to solve the problem haven't yielded any results yet. Any help in resolving this issue would be appreciated.

Here's the process I'm following:

Step 1: POST to{tenant_id}/oauth2/v2.0/token

My POST body includes

  • client_id = "{client_id}"
  • client_secret = "{client_secret}"
  • grant_type = "client_credentials"
  • scope = ""

Step 2: Get access token from previous response, create authorization header

  • Authorization = "Bearer {access_token}"

Step 3: Make a GET request to{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.RecoveryServices/vaults/{vault_name}/securityPIN?api-version=2023-02-01

It is at this point I get the CloudInvalidInputError.Thank you~!

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,143 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 39,136 Reputation points Microsoft Employee

    @Nathan Given Thank you for posting your question.

    I see that you are using REST API to get Recovery Services Vault Security PIN and being greeted with an error message.

    The error message that you are receiving indicates that there is an issue with the input that you are providing to the API. Here are some things that you can check to resolve the issue:

    1. Make sure that you are using the correct values for the placeholders in the URL. Double-check the subscription ID, resource group name, and vault name to ensure that they are correct.
    2. Make sure that you have the necessary permissions to access the resource. Check that your client ID has the appropriate permissions to access the Recovery Services vault.
    3. Check that the API version that you are using is correct. The API version that you are using is 2023-02-01. Make sure that this is the correct version for the API that you are using.
    4. Try using a different tool or method to access the API. For example, you can try using Azure PowerShell to access the API and see if you get the same error message.

    For you reference:

    Hope this helps!

    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments

  2. Nathan Given 26 Reputation points

    @SadiqhAhmed-MSFT I figured it out. The URL is:


    (I forgot the word "backup" in the URL).

    It is also a POST, not a GET.