简体   繁体   中英

Microsoft.Azure.Management.Fluent.Azure never responds

I am trying the "Microsoft.Azure.Management.Fluent" nuget packages to manage my webapps and vms.

I've tried following these samples but it's still not working for me https://github.com/Azure/azure-libraries-for-net/blob/master/AUTH.md

I have verified my clientId & clientSecret & tenantId in the Azure portal and they are valid.

But the code blocks on the "var azure =..." line below and never returns.

So... what am I missing?

    var credentials = SdkContext.AzureCredentialsFactory
        .FromServicePrincipal(clientId,
            clientSecret,
            tentantId,
            AzureEnvironment.AzureGlobalCloud);

    var azure = Microsoft.Azure.Management.Fluent.Azure
        .Configure()
        .Authenticate(credentials)
        .WithDefaultSubscription()
        ;

It was the ".Configure()" call. Not sure where I found that, but it's not part of their suggestions any more. And when I remove it, it works.

var azure = Microsoft.Azure.Management.Fluent.Azure
        //.Configure()
        .Authenticate(credentials)
        .WithDefaultSubscription()
        ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM