- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
从定义了名为 tag1
的标签的资源组(通过门户完成)中,我在 Visual Studio 中拥有以下部署模板:
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('websiteName'))]"
],
"tags": {
"displayName": "website AppSettings"
},
"properties": {
"Setting1": "[resourceGroup().tags.tag1]",
"Setting2": "[parameters('param2')]"
}
}
我收到此错误:
... 'The language expression property 'tags' doesn't exist, available properties are 'id, name, location, properties'...
但是使用 https://resources.azure.com我可以看到资源组确实具有 tag
属性:
{
"id": "/subscriptions/{someguid}/resourceGroups/resourceGroup1",
"name": "resourceGroup1",
"location": "brazilsouth",
"tags": {
"tag1": "test"
},
"properties": {
"provisioningState": "Succeeded"
}
}
有什么方法可以获取部署模板中的资源组标签吗?
正如 @juvchan 指出的,标签必须存在,否则会发生此错误。我创建了标签,但是从 VisualStudio 部署模板时,标签被删除,从门户部署时,标签被保留。这导致了不同的问题。
原因是 Visual Studio 项目有一个包含以下行的 PowerShell 脚本:
#Create or update the resource group using the specified template file and template parameters file
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop
但是 New-AzureRmResourceGroup
cmdlet 不会保留现有标记。意识到。解决方案:修改脚本,如果资源组已存在,则不运行 cmdlet。
最佳答案
用于获取下面资源组标签的 ARM 模板语法是正确的。
"[resourceGroup().tags.tag1]"
您需要确保您的资源组在部署 ARM 模板之前创建了上述标签,以便获取特定标签的值。
"tags": { "tag1": "test" },
当我尝试部署 ARM 模板以获取尚未创建的资源组标签时,我能够重现您的确切错误。
当我在部署之前为资源组创建标签时,我还能够按照 ARM 模板部署中的预期获取资源组标签值。
{
"id": "/subscriptions/{id}/resourceGroups/ResourceGroupwithTag",
"name": "ResourceGroupwithTag",
"location": "southeastasia",
"tags": {
"displayName": "test"
},
"properties": {
"provisioningState": "Succeeded"
}
}
我的 ARM 模板的输出部分,用于显示资源组标签。
"outputs": {
"rgTag": {
"type": "String",
"value": "[resourceGroup().tags.displayName]"
}
}
希望这有帮助!
关于azure - 从 Azure 资源管理器模板中的资源组获取标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43814461/
我有一个 12 节点集群,我运行的是 yarn 架构。似乎我的节点大部分时间都很忙,而且很多时候作业都失败了。如何随时查看资源的使用情况?还有什么方法可以为用户设置有限的资源,例如:如果用户提交作业,
我有一个关于 Xtend 的非常具体的问题。 在我读到的有关 xText/xTend 的每个示例中,我都会看到类似这样的内容: override void doGenerate(Resource re
代码参考 代码文件参考下述详解的类图,工程参考第零章工程说明 。 概述 在游戏项目中有很多资产如:预制体,图片,音频,Lua脚本,Shader等等。他们随打包放在用户的硬盘里。在游戏的运
我有一个包含10个节点的Hadoop集群。在10个节点中,有3个部署了HBase。有两个共享集群的应用程序。 应用程序1从hadoop HDF写入和读取数据。应用程序2将数据存储到HBase中。有没有
例子: var image = UIImage.FromFile("/path/to/image.png"); var imageView = new UIImageView(); imageView
我需要存储 ThirdPartyElm 类型的元素序列,我使用的是 std::vector(或 std::array 如果我需要一个固定大小的序列)。 我想知道我应该如何初始化序列。第一个版本创建一个
我有一个具有UITabBarController的MonoTouch应用程序,每个选项卡都是一个UINavigationController。其中一些包装了一个UIViewController,后者添
所以我一直在研究使用资源管理 API 对 azure 进行只读 api 访问。现在我主要关注虚拟机。我一直在使用这个预发布包和 TokenCredentials: https://www.nuget.
我想获取 Azure 中包含给定标签的资源列表。基本请求形式如下:https://management.azure.com/subscriptions/{subscriptionId}/resourc
我一直在尝试访问 Azure 公开的 REST API,例如“https://management.azure.com/subscriptions?api-version=2016-06-01”,但无
如何使用 Azure 资源管理 API 获取资源组的资源列表 我已经安装了 Microsoft.Azure.Management.ResourceManager.Fluent Nuget 包下面的脚本
如何使用 Azure 资源管理 API 获取资源组的资源列表 我已经安装了 Microsoft.Azure.Management.ResourceManager.Fluent Nuget 包下面的脚本
我正在尝试在 Jersey 中编写 RESTful Web 应用程序时管理竞争资源(如:数据库 session )。通常我会写这样的代码: Session session = getSession()
我是这个论坛的新手。 我正在查看有关 Azure 资源运行状况 Rest Api 的 Microsoft 文档,链接如下: https://azure.microsoft.com/en-us/blog
我想使用这些 API 获取特定 Azure 帐户或订阅的运行状况和其他资源详细信息 https://learn.microsoft.com/en-us/rest/api/resourcehealth/
我正在尝试在 Azure 资源管理的上下文中找到应用程序权限的安全最佳实践。 目前,management.azure.com 仅列出了一项权限,它是management.azure.com/user_
我想使用这些 API 获取特定 Azure 帐户或订阅的运行状况和其他资源详细信息 https://learn.microsoft.com/en-us/rest/api/resourcehealth/
我正在尝试在 Azure 资源管理的上下文中找到应用程序权限的安全最佳实践。 目前,management.azure.com 仅列出了一项权限,它是management.azure.com/user_
我正在寻找一种以编程方式列出组织内的 Google Cloud 项目的方法。我正在尝试使用服务帐户导出的 json 凭据以这种方式实现此目的: // More info on the endp
我正在编写一些用于自动部署Azure网站的代码(包括在Azure中创建网站)。我正在使用 Nuget 中提供的 Azure 管理库和 Azure 资源管理库。大部分内容都已到位,但是我无法找到通过我见
我是一名优秀的程序员,十分优秀!