Need a simpler way to retrieve AutomationAccount Webhook in output
- Dominant language
- TypeScript
- Stars
- 108
- Forks
- 44
- Avg merge
- 18h 53m
- Merged PRs (30d)
- 29
Description
**Is your feature request related to a problem? Please describe.**
Need a simpler way to retrieve AutomationAccount Webhook in Output.
There seems to be an undocumented way to do this with ARM Template (JSON) and `Microsoft.Automation/automationAccounts/webhooks@2018-06-30` but only API version `2015-10-31` is officially correct for Bicep and that also does not support the way Bicep is referencing the "uri" output.
See also:
Azure/bicep#11973 (Closed, never solved) and Azure/bicep#9506
**Describe the solution you'd like**
Below is a "workaround" that does not have bicep build errors. Outcome should be the same, but then a lot simpler.
```bicep
param baseTimeUtcNow string = utcNow('u')
param automationAccountName string
param runbookName string
param webhookName string
resource automationAccount 'Microsoft.Automation/automationAccounts@2023-11-01' existing = {
name: automationAccountName
}
resource automationAccountRunbook 'Microsoft.Automation/automationAccounts/runbooks@2023-11-01' existing = {
name: runbookName
parent: automationAccount
}
var tmpToken11 = uniqueString(subscription().id,resourceGroup().id,automationAccount.name, webhookName)
var tmpToken12 = uniqueString(resourceGroup().id,automationAccount.name, webhookName)
var tmpToken21 = uniqueString(subscription().id,resourceGroup().id,automationAccount.name, runbookName)
var tmpToken22 = uniqueString(resourceGroup().id,automationAccount.name, runbookName)
var webhookTokenPart1 = substring('${tmpToken11}${tmpToken12}',0,20)
var webhookTokenPart2 = substring('${tmpToken21}${tmpToken22}',0,22)
resource webhookRunbookAutomationAccount 'Microsoft.Automation/automationAccounts/webhooks@2015-10-31' = {
parent: automationAccount
name: webhookName
properties: {
expiryTime: dateTimeAdd(baseTimeUtcNow, 'P12M')
isEnabled: true
runbook: {
name: automationAccountRunbook.name
}
uri: '${substring(replace(automationAccount.properties.automationHybridServiceUrl,'.jrds.','.webhook.'), 0, indexOf(automationAccount.properties.automationHybridServiceUrl,'.azure-automation.net/')+25)}webhooks?token=${webhookTokenPart1}%2b${webhookTokenPart2}%3d'
}
}
output webhookUri string = '${substring(replace(automationAccount.properties.automationHybridServiceUrl,'.jrds.','.webhook.'), 0, indexOf(automationAccount.properties.automationHybridServiceUrl,'.azure-automation.net/')+25)}webhooks?token=${webhookTokenPart1}%2b${webhookTokenPart2}%3d'
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Microsoft.Automation/automationAccounts/webhooks resource declarations using API versions 2015-10-31 and 2018-06-30, and compare how Bicep handles the uri output. Review the linked Azure/bicep issues for prior context. Done means a simpler supported webhook URI retrieval path is available without the workaround or Bicep build errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100