3

We have been using Azure API for some time for various operations. For example this is one of the APIs we use https://learn.microsoft.com/en-us/rest/api/servicebus/namespaces/createorupdate and as mentioned in the docs the URL that we send request to is:

management.azure.com

Recently we have had the need to start performing against our Cloud Services via API. I noticed that the URL was different then what we have been using before --

management.core.windows.net

as mentioned here https://learn.microsoft.com/en-us/rest/api/compute/cloudservices/rest-list-cloud-services

Firstly, could someone explain me the differences between those two?

Secondly, how can I authenticate against the management.core.windows.net using tenant/client/secret keys?

Here is the following code I have been using to auth with the first URL.

var context = new AuthenticationContext($"https://login.microsoftonline.com/{Constants.AZURE_TENANT_ID}");
var result = context.AcquireTokenAsync(
                        "https://management.azure.com/",
                        new ClientCredential(Constants.AZURE_MANAGEMENT_API_CLIENT, Constants.AZURE_MANAGEMENT_API_SECRET)
                    ).GetAwaiter().GetResult();
return result.AccessToken;

I tried to simply replace the URL but that did not work. I got the following error:

enter image description here

1 Answer 1

2

could someone explain me the differences between those two?

Azure Resource Manager provider APIs use https://management.azure.com/, and Azure classic deployment model uses https://management.core.windows.net/

how can I authenticate against the management.core.windows.net using tenant/client/secret keys?

You should be able to get the access token if the settings are correct, you can try again.

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

What are you using after login.microsoftonline.com? seems like its something xxx.onmicrosoft.com vs mine is GUID looking tenant ID? I think we are using certification for auth instead of AD user if that makes a difference?
@scorpion5211 I am using the tenant name, tenant id will also be ok. Have you tried again?
Yeah no matter what I do still the same issue. I was informed that another developer had achieved this in other parts of the system so I am going to take a look at what he did and give final update then.
although I am voting for your answer as it seems like others had agreed that what you are suggesting should be working and I think I am just overlooking something.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.