有没有办法使用Azure Management C#API创建资源组?
基本上这个REST API调用:https: //msdn.microsoft.com/en-us/library/azure/dn790525.aspx
我找到了一种使用client.AffinityGroups.Create创建Affinity Group的方法,但这是我发现的最接近的东西.
我发现API调用隐藏在一个只在预览模式下的库中.它位于以下NuGet包中,在Visual Studio中启用include prerelease以在NuGet客户端中找到它.
https://www.nuget.org/packages/Microsoft.Azure.Management.Resources/
然后创建一个我可以使用的资源组
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;
Run Code Online (Sandbox Code Playgroud)
还有另一个堆栈溢出帖子解释了如何进行身份验证: 如何获取Azure ResourceManagementClient对象的标记
以下博客文章更详细地介绍了如何设置身份验证部分所需的TokenCloudCredentials,但仅适用于命令行应用程序:http://www.bradygaster.com/post/using-windows-azure-active-directory- 到验证,在管理的库
如果您想使用命令行应用程序之外的其他内容,则以下内容可用于身份验证:http: //www.dushyantgill.com/blog/2015/05/23/developers-guide-to-auth-with-azure-resource -manager-API /
| 归档时间: |
|
| 查看次数: |
4437 次 |
| 最近记录: |