When trying to use BeginAttachDetachDataDisks(Using GO SDK), I'm getting the following error: The subscription is not enabled for using the attach detach data disks API. I have the attachDisk & detachDisk permission added for the subscription.

Rajat Jain 5 Reputation points
2024-04-04T17:03:43.7033333+00:00

When trying to use BeginAttachDetachDataDisks, I'm getting the following error: "The subscription is not enabled for using the attach detach data disks API". I have the attachDisk & detachDisk permission added for the subscription. I'm able to do the same through CLI. The POST command seems to be the same in both the case. Is there any special permission required at the subscription level to do this? The attachDisk and detachDisk permission that exists for the subscription is under Microsoft.ClassicCompute (Microsoft.ClassicCompute/virtualMachines/attachDisk/action)

I did not find any similar permission under Microsoft.Compute. Is that the difference?

How do I fix it?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,157 questions
Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
572 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,559 questions
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 23,496 Reputation points Microsoft Employee
    2024-04-04T19:01:29.7566667+00:00

    Hello, @Rajat Jain !

    Why am I getting a The subscription is not enabled for using the attach detach data disks API error when trying to use BeginAttachDetachDataDisks (Using GO SDK)?

    Solution (thank you, Andrea Cappelletti!):

    https://github.com/Azure/azure-sdk-for-go/issues/22773

    Solution

    In order to use that specific API you will have to follow these steps to enable it in your subscription:

    Prerequisites To register feature you need Contributor or Owner role on subscription. You can register this feature from CLI, first login: az login Then select your subscription: az account set --subscription "xxxxxx" ->Please replace xxxx by your Sub. ID Then enable the API for your subscription: az feature registration create --namespace Microsoft.Compute --name UseNewDataDisksAttachDetachApi Additionally, you also need to enable a feature called EtagPreview: az feature registration show --name EtagPreview --provider-namespace Microsoft.Compute


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments