[英]ARM template for Azure Log Analytics Data Collector
I have been trying to create an ARM template for the Log Analytics Data collector API connection.我一直在尝试为 Log Analytics 数据收集器 API 连接创建 ARM 模板。 I have almost got the ARM template but I'm unable to find where can I insert the Workspace Key value in the API connection to make it work.
我几乎得到了 ARM 模板,但我无法找到在 API 连接中插入工作区密钥值的位置以使其工作。
Here is my ARM template for the API connection of Azure Log analytics Data collector.=这是我的 ARM 模板,用于 Azure 日志分析数据收集器的 API 连接。=
{
"$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": {
}
}
If you see the tempalte here the username parameter under nonSecretParameterValues is the Workspace ID but I'm unable to find what is the property to be added for Workspace shared key.如果您在此处看到模板,则 nonSecretParameterValues 下的用户名参数是 Workspace ID,但我无法找到要为 Workspace 共享密钥添加的属性。 The below screenshot would be helpful.
下面的屏幕截图会有所帮助。 Can someone help me add that property or you have any ARM for this.
有人可以帮我添加该属性,或者您有任何 ARM 。 I have got this template from the ARMClient Tool.
我从 ARMClient Tool 获得了这个模板。
If you need the log analytics workspace share key in the arm template, you can use the ARM template function listKeys
to get it.如果您需要 arm 模板中的日志分析工作区共享密钥,您可以使用 ARM 模板 function
listKeys
获取。 For more details, please refer to the document更多详细信息,请参阅文档
The expression should be like表达式应该像
listKeys(resourceId('<group name>','Microsoft.OperationalInsights/workspaces', '<space name>'), providers('Microsoft.OperationalInsights', 'workspaces').apiVersions[0]).primarySharedKey]
For example例如
{
"$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": {
}
}
You need the primary/secondary key of the log analytics workspace you have created.您需要已创建的日志分析工作区的主键/辅助键。 This can be found
Advanced Settings
blade of your workspace if you want a portal experience or can be found using the AZ CLI.如果您想要门户体验,可以在工作区的
Advanced Settings
刀片中找到它,或者可以使用 AZ CLI 找到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.