我正在尝试为自动化运行簿创建一个Webhook。到目前为止,我取得了以下成果:
下面是我使用的模板:
"resources": [
{
"name": "[parameters('accountName')]",
"type": "Microsoft.Automation/automationAccounts",
"apiVersion": "2015-10-31",
"location": "[parameters('location')]",
"dependsOn": [ ],
"tags": { },
"properties": {
"sku": {
"name": "[parameters('sku')]"
}
},
"resources": [
{
"name": "[variables('runbookName')]",
"type": "runbooks",
"apiVersion": "2015-10-31",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
],
"tags": { },
"properties": {
"runbookType": "Script",
"logProgress": "false",
"logVerbose": "false",
"publishContentLink": {
"uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
"version": "1.0.0.0"
},
"webhook": {
"name": "test"
}
}
,"resources": [
{
"apiVersion": "2015-10-31",
"type": "webhooks",
"name": "testwebhook",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'), '/runbooks/', variables('runbookName'))]"
]
}
]
},
{
"name": "[parameters('credentialName')]",
"type": "credentials",
"apiVersion": "2015-10-31",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
],
"tags": { },
"properties": {
"userName": "[parameters('userName')]",
"password": "[parameters('password')]"
}
}
]
}
]我无法创建一个网钩。到目前为止,在搜索之后,我还没有找到用于创建runbook的模板模式。任何帮助都是非常感谢的。
提前感谢
发布于 2016-03-30 07:23:03
您不应该将Web钩子放在Runbook的资源中,因为Web钩子属于自动化帐户,而不是Runbook。以下是一个示例:
"resources": [
{
"name": "[parameters('accountName')]",
"type": "Microsoft.Automation/automationAccounts",
"apiVersion": "2015-10-31",
"location": "[parameters('location')]",
"dependsOn": [ ],
"tags": { },
"properties": {
"sku": {
"name": "[parameters('sku')]"
}
},
"resources": [
{
"name": "[variables('runbookName')]",
"type": "runbooks",
"apiVersion": "2015-10-31",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
],
"tags": { },
"properties": {
"runbookType": "Script",
"logProgress": "false",
"logVerbose": "false",
"publishContentLink": {
"uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
"version": "1.0.0.0"
},
"webhook": {
"name": "test"
}
}
,"resources": [
]
},
{
"apiVersion": "2015-10-31",
"type": "webhooks",
"name": "testwebhook",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]",
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'), '/runbooks/', variables('runbookName'))]"
],
"properties": {
"isEnabled": true,
"runbook": {
"name": "[variables('runbookName')]"
}
}
},
{
"name": "[parameters('credentialName')]",
"type": "credentials",
"apiVersion": "2015-10-31",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
],
"tags": { },
"properties": {
"userName": "[parameters('userName')]",
"password": "[parameters('password')]"
}
}
]
}
]在使用上面的模板进行测试之后,我得到以下消息:
New-AzureRmResourceGroupDeployment : 9:35:31 AM - Resource Microsoft.Automation/automationAccounts/webhooks 'automationARMtest/testwebhook' failed with message '{"Message":"Invalid Uri"}'
At line:1 char:1
+ New-AzureRmResourceGroupDeployment -name automationARMtest -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand正如伊丽莎白·库珀在下面所说的,Web钩子在ARM模板中还不受支持。我已经提交了一个功能请求。请投这里票
https://stackoverflow.com/questions/36300371
复制相似问题