我已经有问题了很多天了。
我在我的程序中使用Azure.Fluent包,我必须创建一个ResourceGroup,但是当我创建它或列出它们时,我得到了MissingMethodsException,我不知道为什么。我从没想过解决这个问题的办法。
这是我的代码:
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)'.‘
发布于 2018-05-15 09:26:11
我在我的站点上用Microsoft.Azure.Management.Fluent 版本1.10.0和Microsoft.Azure.Management.ResourceManager.Fluent 版本1.10.0很好地测试了它。
并使用以下代码创建并列出资源组:
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核心等等。
发布于 2018-12-04 22:13:32
这个问题在不久前的Azure Fluent SDK中得到了修正。请参考最新(目前1.18.0版) nuget套餐。
https://stackoverflow.com/questions/50345909
复制相似问题