gpt4 book ai didi

azure - Azure Log Analytics 数据收集器的 ARM 模板

转载 作者:行者123 更新时间:2023-12-03 00:41:24 25 4
gpt4 key购买 nike

我一直在尝试为 Log Analytics 数据收集器 API 连接创建 ARM 模板。我几乎已经获得了 ARM 模板,但我无法找到在 API 连接中哪里可以插入 Workspace Key 值以使其正常工作。

这是我的用于 Azure 日志分析数据收集器的 API 连接的 ARM 模板。=

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"variables": {
},
"resources": [
{
"properties": {
"displayName": "pankajtestlog",
"statuses": [
{
"status": "Connected"
}
],
"customParameterValues": {},
"nonSecretParameterValues": {
"username": "yP4jrRxnB8EfXIO8Y27as+JbDMEUmIOk1K4QB5NuvTei9yELgzdjUCejWmwgb4AVpw81lg0NpOcpvdvmLM/Hqw=="
},
"createdTime": "2020-04-11T07:57:31.1911201Z",
"changedTime": "2020-04-11T07:57:31.1911201Z",
"api": {
"name": "azureloganalyticsdatacollector",
"displayName": "Azure Log Analytics Data Collector",
"description": "Azure Log Analytics Data Collector will send data to any Azure Log Analytics workspace.",
"iconUri": "https://connectoricons-prod.azureedge.net/azureloganalyticsdatacollector/icon_1.0.1274.1744.png",
"brandColor": "#0072C6",
"category": "Standard",
"id": "/subscriptions/44357e6b-77a0-4b60-a817-27e62ffb6fdd/providers/Microsoft.Web/locations/usgovarizona/managedApis/azureloganalyticsdatacollector",
"type": "Microsoft.Web/locations/managedApis"
},
"testLinks": []
},
"id": "/subscriptions/44357e6b-77a0-4b60-a817-27e62ffb6fdd/resourceGroups/RG-Guardian-POC/providers/Microsoft.Web/connections/azureloganalyticsdatacollector-1",
"name": "azureloganalyticsdatacollector-1",
"type": "Microsoft.Web/connections",
"location": "usgovarizona",
"apiVersion": "2016-06-01"
}
],
"outputs": {
}
}

如果您在此处看到模板,则 nonSecretParameterValues 下的用户名参数是工作区 ID,但我无法找到要为工作区共享 key 添加的属性是什么。下面的屏幕截图会有所帮助。有人可以帮我添加该属性吗?或者您有任何 ARM 可以实现此目的。我从 ARMClient 工具获得了这个模板。

enter image description here

最佳答案

如果您需要arm模板中的日志分析工作区共享 key ,可以使用ARM模板函数listKeys来获取。更多详情请引用document

表达式应该是这样的

listKeys(resourceId('<group name>','Microsoft.OperationalInsights/workspaces', '<space name>'), providers('Microsoft.OperationalInsights', 'workspaces').apiVersions[0]).primarySharedKey]

例如

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location":{
"type": "string",
"defaultValue": "[resourceGroup().location]"


},
"azureloganalyticsdatacollector_1_Connection_Name": {
"type": "string",
"defaultValue": "azureloganalyticsdatacollector"
},
"azureloganalyticsdatacollector_1_Connection_DisplayName": {
"type": "string",
"defaultValue": "test2"
},
"azureloganalyticsdatacollector_1_username": {
"type": "string",
"defaultValue":"fcbee0dd-1bb6-4c2b-a522-ea90b8606752",
"metadata": {
"description": "The unique identifier of the Azure Log Analytics workspace."
},

},
"azureloganalyticsdatacollector_1_password": {
"type": "securestring",
"defaultValue":"5SFB4B54oiTKBZDcJrBgMw8c81hEaW7rYtC2A9wLh4/eATEOI4XxvGBVOor/ulmYRJePr3VqxACjBk7fvCpWbQ==",
"metadata": {
"description": "The primary or secondary key of the Azure Log Analytics workspace."
}
}
},
"variables": {},
"resources": [
{
"type": "MICROSOFT.WEB/CONNECTIONS",
"apiVersion": "2018-07-01-preview",
"name": "[parameters('azureloganalyticsdatacollector_1_Connection_Name')]",
"location": "[parameters('location')]",
"properties": {
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('location'), '/managedApis/', 'azureloganalyticsdatacollector')]"
},
"displayName": "[parameters('azureloganalyticsdatacollector_1_Connection_DisplayName')]",
"parameterValues": {
"username": "[parameters('azureloganalyticsdatacollector_1_username')]",
"password": "[listKeys(resourceId('defaultresourcegroup-se','Microsoft.OperationalInsights/workspaces', 'DefaultWorkspace-e5b0fcfa-e859-43f3-8d84-5e5fe29f4c68-SE'), providers('Microsoft.OperationalInsights', 'workspaces').apiVersions[0]).primarySharedKey]"
}
}
}
],
"outputs": {

}
}

enter image description here

关于azure - Azure Log Analytics 数据收集器的 ARM 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61224380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com