azure Bicep使用URI发布Runbook

r55awzrz  于 2022-12-14  发布在  其他
关注(0)|答案(1)|浏览(117)

我正在使用Bicep创建自动化帐户、Blob存储、将文件上载到Blob,然后在我的自动化帐户中创建Runbook。这在第一次运行时有效,但如果我更新进入我的Blob的文件,这不会反映在我的Runbook中。
这是我的Runbook部署的副本-是否有可能发布链接URI被缓存,而它没有“重新获取”脚本内容?

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'
    }
    
  }
  
}```
ia2d9nvy

ia2d9nvy1#

当您重新部署模板时,什么都没有改变,所以我猜ARM API甚至不会尝试将部署重新提交给资源提供者。
您可以添加一个参数来尝试强制更新:

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'
    }
  }
}
...

相关问题