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?

【Azure Functions】デプロイスロットへの関数のデプロイ

0
Last updated at Posted at 2025-11-18

概要

デプロイスロットは、関数アプリで "スロット" と呼ばれる別のインスタンスを実行する機能です。
スロットごとに稼働する関数や環境変数は独立しています。
デプロイスロットに関数をデプロイする方法についてまとめます。

構成

  • 前提:
    • 関数アプリとデプロイスロットが作成済み
    • ローカル環境にAzure CLIがインストールされている
    • 作業前にAzure CLIでログインしている
  • スタック:
    • 運用スロット: Node.js 20 LTS
    • デプロイスロット: Node.js 22 LTS
  1. Nodeポータブル版のダウンロード
    Node.js 公式
    https://nodejs.org/ja/download
    Node.jsを既にインストールしている場合は不要です。
    今回は環境依存をなるべく少なくするため、ポータブル版のNode.jsを使用します。
    作業ディレクトリにnodeというフォルダを作成し、このフォルダに展開しました。

  2. Azure Functions Core Tools のインストール
    .\node\npm.cmd install -g azure-functions-core-tools@4 --prefix .\tools
    

  3. 関数アプリのひな型作成
    .\tools\func.cmd init . --worker-runtime node --language typescript --model v4
    

  4. 関数アプリのテンプレート作成
    .\tools\func.cmd new --name HttpTrigger1 --template "HTTP trigger" --authlevel anonymous
    

  5. .funcignorenodetoolsフォルダを追加する

  6. ビルド
    .\node\npm.cmd run build
    

  7. デプロイ
    .\tools\func.cmd azure functionapp publish <関数アプリ名> --slot <デプロイスロット名>
    

※ 先にデプロイスロットのスタック設定のバージョンをNode.js 22に変更しておくこと。
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?