Hi ,
I am trying to generate the token using Azure Management Certificate.
For this i have downloaded the Publish Setting file and store the certificate in My store current user location. Now i am trying to generate the access token for Some Azure Management API Calls. but getting the exception
"Invalid provider type specified."
Below is the code for generating token
var tenant = "XXXXX-XXXXXX-XXXXXX-XXXXX";var authContext = new AuthenticationContext(string.Format("https://login.windows.net/{0}", tenant));
var publishSettingsFile = @"D:\mysettingfile.publishsettings";
XDocument xdoc = XDocument.Load(publishSettingsFile);
var managementCertbase64string = xdoc.Descendants("PublishProfile").Descendants("Subscription").Attributes().Where(x=> x.Name== "ManagementCertificate").Select(x=>x.Value).FirstOrDefault();
var importedCert = new X509Certificate2(Convert.FromBase64String(managementCertbase64string));
var thumbprint = importedCert.Thumbprint;
X509Store store = new X509Store(StoreName.My,StoreLocation.CurrentUser); store.Open(OpenFlags.ReadWrite); store.Add(importedCert);
X509Certificate2 managementCert = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false)[0];
store.Close();
var certCred = new ClientAssertionCertificate("XXXXX-XXXXXX-XXXXX-XXXXX", managementCert);