1

I've a problem since many days.

I'm using the Azure.Fluent package in my program and I must to create a ResourceGroup, but when I create it or list themw, I got the MissingMethodsException and I don't know why. And I've never founded any solution to this.

This is my code :

            AzureCredentials cred = SdkContext
            .AzureCredentialsFactory
            .FromServicePrincipal(
                ClientId, 
                ServicePrincipalPassword, 
                AzureTenantId, 
                AzureEnvironment.AzureGlobalCloud
            );

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

        var resourceGroup = azure.ResourceGroups.List();

Thanks in advance !

EDIT

This is the detailed error I have :

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

Axeen
  • 270
  • 1
  • 2
  • 7

2 Answers2

0

I test it well in my site with Microsoft.Azure.Management.Fluent version 1.10.0 and Microsoft.Azure.Management.ResourceManager.Fluent version 1.10.0.

And create and list resourcegroup with the following code:

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();

The credential contains clinetid, clientkey, tenantid and subscriptionid.

If you still have any problem, please show me more detailed information like what your fluent SDK version and you use .net or .net core and so on.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • I'm already using 1.10.0 of thoose packages and it doesn't work. See my edit on my post for the detailed error. – Axeen May 15 '18 at 12:22
  • @Ezekief, this exception is typically thrown when an attempt is made to dynamically access a deleted or renamed method of an assembly that is not referenced by its strong name. – Joey Cai May 25 '18 at 02:42
  • Your could try to delete every built item and rebuild/redeploy the entire solution. Troubleshooting with this [thread](https://stackoverflow.com/questions/8058832/system-missingmethodexception-method-not-found). – Joey Cai May 25 '18 at 02:43
0

This issue was fixed in Azure Fluent SDK a while ago. Please reference latest (v.1.18.0 at the moment) nuget packages.

hovsepm
  • 146
  • 1
  • 3