通过 azure 管道单阶段将包部署到多个 webapp 服务
Deploy packages to multiple webapp service by azure pipeline single stage
我在 azure 中有 100 多个 webapp 服务。我想使用一个管道 yml 文件通过 azure 管道在 100 个 webapps 中部署包。但是我找不到这样的文档。我有一份微软文档,他们更愿意增加流水线步骤。如果我有 100 个 webapps 服务,那么必须为每个部署添加 100 个步骤。这不是一种有效的方法,而且很耗时。我要的就是这一步
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy'
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
appType: webApp
ResourceGroupName: $(group)
appName: 'JustGoTestAgain, justgotesttwo, webapp123, webapp555, webapp777 and so on ........'
package: '$(build.artifactstagingdirectory)/**/*.zip'
此 yaml 文件显示错误。我找不到任何必要的扩展来修复它。我也找不到与此问题相关的任何 azure powershell 部署命令。我怎样才能得到解决方案?
你将无法像这样做到这一点。但是你可以使用 Azure Cli task:
- task: AzureCLI@2
displayName: Azure CLI
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$apps= @('JustGoTestAgain, justgotesttwo, webapp123, webapp555, webapp777 and so on ........')
foreach ($app in $apps) {
az webapp deployment source config-zip -g $(group) -n $app --src '$(build.artifactstagingdirectory)/SOME_FOLDER/Artifact.zip'
}
这里有更多关于部署的详细信息itself
另一种在失败时继续执行多任务的方法是:
parameters:
- name: apps
type: object
default:
- JustGoTestAgain
- justgotesttwo
- and so on
steps:
- ${{ each app in parameters.apps}}:
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy ${{ app }}'
continueOnError: true
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
appType: webApp
ResourceGroupName: $(group)
appName: ${{ app }}
package: '$(build.artifactstagingdirectory)/**/*.zip'
Thete 与 space 有问题。现在好了。除此之外 connectedServiceName
只有一个问题
Job Job: Step input azureSubscription references service connection $(Parameters.connectedServiceName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz. Job Job: Step input azureSubscription references service connection $(Parameters.connectedServiceName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz. Job Job: Step input azureSubscription references service connection $(Parameters.connectedServiceName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.
我在这里跳过了,因为你的解决方案中已经有了它。
我在 azure 中有 100 多个 webapp 服务。我想使用一个管道 yml 文件通过 azure 管道在 100 个 webapps 中部署包。但是我找不到这样的文档。我有一份微软文档,他们更愿意增加流水线步骤。如果我有 100 个 webapps 服务,那么必须为每个部署添加 100 个步骤。这不是一种有效的方法,而且很耗时。我要的就是这一步
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy'
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
appType: webApp
ResourceGroupName: $(group)
appName: 'JustGoTestAgain, justgotesttwo, webapp123, webapp555, webapp777 and so on ........'
package: '$(build.artifactstagingdirectory)/**/*.zip'
此 yaml 文件显示错误。我找不到任何必要的扩展来修复它。我也找不到与此问题相关的任何 azure powershell 部署命令。我怎样才能得到解决方案?
你将无法像这样做到这一点。但是你可以使用 Azure Cli task:
- task: AzureCLI@2
displayName: Azure CLI
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$apps= @('JustGoTestAgain, justgotesttwo, webapp123, webapp555, webapp777 and so on ........')
foreach ($app in $apps) {
az webapp deployment source config-zip -g $(group) -n $app --src '$(build.artifactstagingdirectory)/SOME_FOLDER/Artifact.zip'
}
这里有更多关于部署的详细信息itself
另一种在失败时继续执行多任务的方法是:
parameters:
- name: apps
type: object
default:
- JustGoTestAgain
- justgotesttwo
- and so on
steps:
- ${{ each app in parameters.apps}}:
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy ${{ app }}'
continueOnError: true
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
appType: webApp
ResourceGroupName: $(group)
appName: ${{ app }}
package: '$(build.artifactstagingdirectory)/**/*.zip'
Thete 与 space 有问题。现在好了。除此之外 connectedServiceName
Job Job: Step input azureSubscription references service connection $(Parameters.connectedServiceName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz. Job Job: Step input azureSubscription references service connection $(Parameters.connectedServiceName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz. Job Job: Step input azureSubscription references service connection $(Parameters.connectedServiceName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.
我在这里跳过了,因为你的解决方案中已经有了它。