Issue with Azure REST API when retrieving soft-deleted resources from a specific resource group

Prashant Sambhaji Malusare 0 Reputation points
2024-11-06T12:57:25.6166667+00:00

Hello Team,

I am encountering an issue when trying to retrieve a list of soft-deleted resources from a specific resource group within my Azure subscription. I am using the following az rest command:

az rest --method get --url "https://management.azure.com/subscriptions/{{SubscriptionID}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Resources/deletedResources?api-version=2024-08-01"

However, I am consistently receiving the following error message:

Method Not Allowed({
    "error": {
        "code": "HttpMethodIsNotSupported",
        "message": "The HTTP method 'GET' is not supported at scope '/subscriptions/{{SubscriptionID}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Resources/deletedResources'. Please try your request at a different scope."
    } })

What I’ve Tried:

  • I verified that I’m using the correct subscription ID and resource group name.
  • I ensured that the API version (2024-08-01) is valid and up-to-date according to the official documentation.
  • I tried issuing the same request using different scopes (e.g., at the subscription level), but I still receive the same error.

Expected Behavior:

I would expect the GET request to return a list of soft-deleted resources from the specified resource group. However, based on the error message, it seems that the GET method is not supported at the scope of the resource group level for the deletedResources endpoint.

Request:

Could you kindly help clarify:

  1. Is querying soft-deleted resources at the resource group level not supported? If so, could you provide the correct scope or API call to retrieve deleted resources at the resource group level?
  2. Are there any known restrictions or limitations when using this API to query soft-deleted resources for a specific resource group? Is there a different API version I should try, or should I use an alternative method to achieve this?
  3. Any suggestions on the proper approach or alternative solutions would be greatly appreciated.

I would really appreciate your assistance in resolving this issue as soon as possible. If there are any additional details needed or if I need to try a different approach, please let me know.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,212 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deepanshukatara-6769 11,625 Reputation points
    2024-11-06T13:22:54.02+00:00

    Hello Prashant , Welcome to MS Q&A

    Querying soft-deleted resources at the resource group level is not directly supported. Instead, you should use the specific API calls designed for retrieving soft-deleted resources. For API Management, you can list all soft-deleted services available for undelete for a given subscription by using the appropriate API Management REST API.

    To retrieve soft-deleted resources, you can use the following API call:

    List all soft-deleted instances for a given subscription for API management

    GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices?api-version=2021-08-01
    
    
    

    This API call allows you to list soft-deleted services, but it does not filter by resource group. You may need to implement additional logic on the client side to filter the results based on your resource group.

    As for limitations, you should ensure that you have the necessary RBAC permissions at the subscription scope in addition to Contributor access to the API Management instance. There are no specific restrictions mentioned regarding querying soft-deleted resources at the resource group level, but the API version should be at least 2020-06-01-preview or later for the relevant operations.

    If you're looking for alternatives, consider checking if the resources support soft delete and whether you can restore them using the soft delete features available for specific resource types.

    Moreover in Azure , The following Azure resources are supported by REST API soft-delete:

    1. API Management: Soft-delete is available for API Management instances, allowing recovery of recently deleted instances during a retention period.
    2. Key Vault: Soft-delete is implemented for Key Vaults, enabling recovery of deleted vaults and their objects (keys, secrets, certificates) for a configurable period.
    3. SQL Server and SAP HANA in Azure VM: Soft-delete is supported for backup data related to SQL Server and SAP HANA in Azure VMs, retaining deleted backup data for an additional 14 days.

    References:

    Please let me know if any other questions

    Kindly accept if it helps

    Thanks
    Deepanshu


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.