I am trying to implement Azure API Management APIs using Microsoft.Azure.Management.ApiManagement
4.0.4-preview.
No where I see documentation for implementa
@Joseph, I had the same issue with unauthorized responses. Inspected the request made through the ApiManagementClient. Two things were wrong:
Corrected this by doing:
var credentials = new MyCredentials();
var client = new ApiManagementClient(new Uri("https://management.azure.com/"), credentials);
client.SubscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
client.HttpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + credentials.AuthenticationToken);
var result = await client.User.ListByServiceAsync("resource-group", "service");
MyCredentials looks the same as the myServiceCredentials class in the previous response and it inherits from ServiceClientCredentials. Had to make the AuthenticationToken prop public though.