I'm attempting to use the Azure Fluent Resource Management and seem unable to login. The "
Microsoft.Azure.Management.Fluent.Authenticate
method fails to return. Considering the code below, api.Authenticate never returns and no exception is ever caught. I am confident the credentials are correct as I use them elsewhere.
try
{
var credentials = SdkContext.AzureCredentialsFactory
.FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);
var api = Microsoft.Azure.Management.Fluent.Azure.Configure();
var authenticated = api.Authenticate(credentials);
var subscribed = authenticated.WithDefaultSubscriptionAsync();
return await subscribed;
}
catch(Exception e)
{
throw e;
}
I changed my code to create the RestClient and pass that into Authenticate method and this seems to work. Not really sure why, I looked on Microsoft's GitHub and can't see a reason for this. Regardless, if anyone is having a similar issue, give this a go!