I am using Bicep to create an Automation Account, Blob storage, uploading a file to Blob, and then creating a Runbook inside my Automation Account. This works the first time, but if i update the file that goes into my blob, this isnt reflected in my runbook.
Here is a copy of my runbook deployment - is it possible the publish link URI gets cached and it doesn't 'refetch' the script content?
resource symbolicname 'Microsoft.Automation/automationAccounts/runbooks@2022-08-08' = {
name: 'Schedule Summary Table Rebuild'
location: automationAccount.location
tags: _tags
dependsOn: [deploymentScript]
parent: automationAcc
properties: {
description: 'Automation to recreate summary tables.'
logActivityTrace: 0
logProgress: true
logVerbose: true
runbookType: 'PowerShell7'
publishContentLink: {
uri:'https://storageacc.blob.core.windows.net/data/ExecuteSQL.txt'
version:'1.0.0.0'
}
}
}```
CodePudding user response:
When you redeploy the template, nothing has changed so I'm guessing the ARM API doesn't even try to resubmit the deployment to the resource provider.
You could add a parameter to try to force the update:
param forceUpdate string = newGuid()
...
resource symbolicname 'Microsoft.Automation/automationAccounts/runbooks@2022-08-08' = {
name: 'Schedule Summary Table Rebuild'
location: automationAccount.location
tags: _tags
dependsOn: [ deploymentScript ]
parent: automationAcc
properties: {
description: 'Automation to recreate summary tables.'
logActivityTrace: 0
logProgress: true
logVerbose: true
runbookType: 'PowerShell7'
publishContentLink: {
uri: 'https://storageacc.blob.core.windows.net/data/ExecuteSQL.txt?forceUpdate=${forceUpdate}'
version: '1.0.0.0'
}
}
}
...