0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AzureDevOpsパイプラインで、AppServiceのスロットをスワップする

Posted at

背景

リリース作業の一連のパイプラインの中で、AppServiceのスロットスワップが手動で行う必要があった

AppServiceのスロットスワップもパイプラインから実施する

対応

スワップ用のパイプラインを作成

下記yamlを定義する。

parameters:
- name: TargetSlot
  displayName: TargetSlot
  type: string
  default: stage
  values:
  - stage
  - sorry
  - production
- name: SourceSlot
  displayName: SourceSlot
  type: string
  default: stage
  values:
  - stage
  - sorry
  - production

# Azureリソースのスワップ
steps:
- task: AzureAppServiceManage@0
  displayName: スロットのスワップ
  inputs:
    azureSubscription: xxxxx
    Action: Swap Slots
    SwapWithProduction: false
    WebAppName: xxxxx
    ResourceGroupName: xxxxx
    TargetSlot: ${{ parameters.TargetSlot }}
    SourceSlot: ${{ parameters.SourceSlot }}

parametersをパイプライン実行時に指定することで、スワップ対象のスロットを選択できるようにしている。

(パイプライン実行時に↓こんな感じで選べる)

image.png

※AzurePortal側の環境変数の設定で「デプロイスロットの設定」にチェックがついていない環境変数はスワップ時に置いてかれます。。

image.png

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?