0

I am trying to generate the SAS URI for one of the snapshot exist on resource group using microsoft provided API. Below is the snippet code: url = f"https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{target_resource_group}/providers/Microsoft.Compute/snapshots/{snap_name}/beginGetAccess"

headers = {'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json'}

params = {'api-version': '2021-12-01'}

body= {
    "access": "Read",
    "durationInSeconds": 3000
    }
json_body= json.dumps(body, indent=2)

accessSAS=requests.post(url, headers=headers,  params=params, data=json_body, verify=False)

But I am receiving the response as <Response [202]>. Could anyone help me with the issue.

Tom
  • 47,574
  • 2
  • 16
  • 29

1 Answers1

0

Response 202 means that Azure accepts your request but it is handling your request. It is an asynchronous operation. Therefore, the response header will give you another url for getting the result. You can refer the following link to get what you want. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/async-operations

Ivan
  • 1