Azure Resource Group Set Tags with SDK?

房东的猫 提交于 2019-12-05 21:56:41

I assume you're using nuget package id="Microsoft.Azure.Management.Resources" version="3.4.0-preview".

The sample code for adding tag(s) to Azure Resource Group using the ARM .NET SDK above is as below:

var tag = new Dictionary<string, string> {{tagName, tagValue}};
var rg = new ResourceGroup() { Name = rgName, Location = rgLocation, Tags = tag };
await client.ResourceGroups.CreateOrUpdateAsync(rgName, rg);

Note: This code sample should backward-compatible with older release version of the above-mentioned nuget package.

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!