首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure .NET API - MissingMethodException

Azure .NET API - MissingMethodException
EN

Stack Overflow用户
提问于 2018-05-15 08:46:10
回答 2查看 352关注 0票数 1

我已经有问题了很多天了。

我在我的程序中使用Azure.Fluent包,我必须创建一个ResourceGroup,但是当我创建它或列出它们时,我得到了MissingMethodsException,我不知道为什么。我从没想过解决这个问题的办法。

这是我的代码

代码语言:javascript
复制
            AzureCredentials cred = SdkContext
            .AzureCredentialsFactory
            .FromServicePrincipal(
                ClientId, 
                ServicePrincipalPassword, 
                AzureTenantId, 
                AzureEnvironment.AzureGlobalCloud
            );

        var azure = Azure
            .Configure()
            .Authenticate(cred)
            .WithSubscription(AzureSubscriptionId);

        var resourceGroup = azure.ResourceGroups.List();

提前谢谢!

编辑

这是我所犯的详细错误:

Microsoft.Rest.Azure.Authentication.UserTokenProvider.LoginSilentAsync(System.String,System.MissingMethodException:'Méthode introuvable:'System.Threading.Tasks.Task`1 System.Threading.Tasks.Task`1 System.String,Microsoft.Rest.Azure.Authentication.ActiveDirectoryServiceSettings,Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache)'.‘

EN

回答 2

Stack Overflow用户

发布于 2018-05-15 09:26:11

我在我的站点上用Microsoft.Azure.Management.Fluent 版本1.10.0Microsoft.Azure.Management.ResourceManager.Fluent 版本1.10.0很好地测试了它。

并使用以下代码创建并列出资源组:

代码语言:javascript
复制
var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"D:\azurecred.txt"); //get azure credentials from file
var azure = Azure
    .Configure()
    .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
    .Authenticate(credentials)
    .WithDefaultSubscription();
var account = azure.StorageAccounts.List();
var rg = azure.ResourceGroups.Create();
var resourceGrouplist = azure.ResourceGroups.List();

凭证包含clinetid、clientkey、tenantid和订阅and。

如果您仍然有任何问题,请向我展示更详细的信息,如您的fluent SDK版本,您使用.net或.net核心等等。

票数 0
EN

Stack Overflow用户

发布于 2018-12-04 22:13:32

这个问题在不久前的Azure Fluent SDK中得到了修正。请参考最新(目前1.18.0版) nuget套餐。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50345909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档