I have an Azure account and I need to do this using.NEt 4.5 class library
I have found few articles but no complete articles or mostly using asp.net Core. I need to create it using .Net 4.5
Can you please suggest solution?
We can use Microsoft.Azure.Management.Fluent library to manage Azure resources (https://www.nuget.org/packages/Microsoft.Azure.Management.Fluent/)
Combined with ARM template for each of the resources (KeyVault, WebApp and any other resource) we can create the resource by calling the Fluent library for each template
Providing sample code below for creating Storage Account using Fluent library
string tenantId = "";
string clientId = "";
string clientSecret = "";
var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);
var azure = Azure.Configure().WithLogLevel(Microsoft.Azure.Management.ResourceManager.Fluent.Core.HttpLoggingDelegatingHandler.Level.Basic).Authenticate(credentials).WithSubscription("<<subscriptionid>>");
var templateString = File.ReadAllText("storageaccountARMTemplate.json");
var resourceName = "storageaccounttemplate";
var resourceGroupName = "rglearnazure";
azure.Deployments.Define(resourceName).WithExistingResourceGroup(resourceGroupName).WithTemplate(templateString).WithParameters("{}").WithMode(DeploymentMode.Incremental).Create();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With