0

failed to obtain a response: GET https://management.azure.com/subscriptions//providers/Microsoft.Authorization/locks

RESPONSE 404: 404 Not Found ERROR CODE: InvalidResourceType {
"error": { "code": "InvalidResourceType", "message": "The resource type 'locks' could not be found in the namespace 'Microsoft.Authorization' for api version '2020-05-01'. The supported api-versions are '2015-01-01,2015-05-01-preview,2015-06-01,2016-09-01,2017-04-01'." } }

Following is the code snippet :

sess, err := azidentity.NewClientSecretCredential(az_tenant_id, az_client_id, az_secret_id, nil)
    if err != nil {
        util.Log.Errorln(err.Error())
    }

    client := armlocks.NewManagementLocksClient(subID, sess, nil)

    page := client.ListAtSubscriptionLevel(&armlocks.ManagementLocksClientListAtSubscriptionLevelOptions{Filter: nil})

    ctx := context.Background()
    util.Log.Errorln("debugging....2")

    for page.NextPage(ctx) {
        resp := page.PageResponse()
        for _, v := range resp.Value {
            util.Log.Errorln(v)
            util.Log.Errorln("debugging....3")
        }
    }

    if err := page.Err(); err != nil {
        util.Log.Errorf("failed to obtain a response: %v", err)
    }
jch
  • 5,382
  • 22
  • 41

1 Answers1

0

For further investigation, I've contacted the Azure-SDK and Service team to find out why the Azure-sdk for GoLang uses an unsupported version of the 'Microsoft.Authorization' namespace.

Here is Github link for your reference: https://github.com/Azure/azure-rest-api-specs/issues/18924

sikumars-msft
  • 326
  • 1
  • 5