Create a resource group using the Azure C # API

Is there a way to create a resource group with the Azure Management C # API?

Basically this REST API call: https://msdn.microsoft.com/en-us/library/azure/dn790525.aspx

I found a way to create an Affinity group using client.AffinityGroups.Create, but this is the closest I found.

+4
source share
2 answers

I found that the API call was hidden in the library, which is only in preview mode. It is found in the next NuGet package, enable pre-validation in Visual Studio to find it in the NuGet client.

https://www.nuget.org/packages/Microsoft.Azure.Management.Resources/

Then to create a resource group I can use

var credentials = new TokenCloudCredentials("", "");
var client = new Microsoft.Azure.Management.Resources.ResourceManagementClient(credentials);            
var result = c.ResourceGroups.CreateOrUpdateAsync("MyResourceGroup", new Microsoft.Azure.Management.Resources.Models.ResourceGroup("West US"), new System.Threading.CancellationToken()).Result;

, , : Azure ResourceManagementClient

, TokenCloudCredentials, , , : http://www.bradygaster.com/post/using-windows-azure-active-directory-to-authenticate-the-management-libraries

- , : http://www.dushyantgill.com/blog/2015/05/23/developers-guide-to-auth-with-azure-resource-manager-api/

+5

https://resources.azure.com - ARMExplorer REST PowerShell . API- REST. # WebClient.

+1

All Articles