I am trying to get a list of app services in Azure using the following , in a winforms app.
string clientId = "your_client_id";
string clientSecret = "your_client_secret";
string tenantId = "your_tenant_id";
string subscriptionId = "your_subscription_id";
var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientId,
clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);
var azure = Azure.Configure().Authenticate(credentials).WithSubscription(subscriptionId);
But the error i get is that:
"The type or namespace Configure does not exists in the namesapce Azure"
I have installed the namespace Microsoft.Azure.Management.Fluent with Nuget packages and no difference .
How can i fix this ?
2
Answers
I believe you may be running into an issue with conflicting NuGet packages.
Try using the fully-qualified class name like this:
Please note that the
Microsoft.Azure.Management.Fluent
SDK package is deprecated. The suggested alternative is Azure.ResourceManager.Alternatively, you can achieve your requirement using
Azure.ResourceManager.ResourceGraph
this sdk package provides the ability to effectively query at scale across a given set of subscriptions. Sample code is here. Hope this helps.