質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Azure

Azureは、マイクロソフトのクラウド プラットフォームで、旧称は Windows Azureです。PaaSとIaaSを組み合わせることで、 コンピューティング・ストレージ・データ・ネットワーキング・アプリケーションなど多くの機能を持ちます。

Q&A

解決済

1回答

503閲覧

Azure App Service の環境変数をARMテンプレートに追加したい

nana_1107

総合スコア8

Azure

Azureは、マイクロソフトのクラウド プラットフォームで、旧称は Windows Azureです。PaaSとIaaSを組み合わせることで、 コンピューティング・ストレージ・データ・ネットワーキング・アプリケーションなど多くの機能を持ちます。

0グッド

0クリップ

投稿2023/03/10 10:25

実現したいこと

Azure App Service の環境変数の設定を
ARMテンプレートに追加したいです。
必要な情報がありましたら、追記しますので
ご教授願います。

前提

下記の環境設定をARMテンプレートに追加したいのですが、
書き方が分かりません。

追加したい設定

MODULE /app/test.py

該当のソースコード

ARMテンプレート

1 2{ 3 "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 4 "contentVersion": "1.0.0.0", 5 "metadata": { 6 "_generator": { 7 "name": "bicep", 8 "version": "0.5.6.12127", 9 "templateHash": "10602523904429381366" 10 } 11 }, 12 "parameters": { 13 "webAppName": { 14 "type": "string", 15 "defaultValue": "[format('webApp-{0}', uniqueString(resourceGroup().id))]", 16 "minLength": 2, 17 "metadata": { 18 "description": "Web app name." 19 } 20 }, 21 "location": { 22 "type": "string", 23 "defaultValue": "[resourceGroup().location]", 24 "metadata": { 25 "description": "Location for all resources." 26 } 27 }, 28 "sku": { 29 "type": "string", 30 "defaultValue": "F1", 31 "metadata": { 32 "description": "The SKU of App Service Plan." 33 } 34 }, 35 "linuxFxVersion": { 36 "type": "string", 37 "defaultValue": "DOTNETCORE|3.0", 38 "metadata": { 39 "description": "The Runtime stack of current web app" 40 } 41 }, 42 "repoUrl": { 43 "type": "string", 44 "defaultValue": " ", 45 "metadata": { 46 "description": "Optional Git Repo URL" 47 } 48 } 49 }, 50 "variables": { 51 "appServicePlanPortalName": "[format('AppServicePlan-{0}', parameters('webAppName'))]" 52 }, 53 "resources": [ 54 { 55 "type": "Microsoft.Web/serverfarms", 56 "apiVersion": "2021-02-01", 57 "name": "[variables('appServicePlanPortalName')]", 58 "location": "[parameters('location')]", 59 "sku": { 60 "name": "[parameters('sku')]" 61 }, 62 "kind": "linux", 63 "properties": { 64 "reserved": true 65 } 66 }, 67 { 68 "type": "Microsoft.Web/sites", 69 "apiVersion": "2021-02-01", 70 "name": "[parameters('webAppName')]", 71 "location": "[parameters('location')]", 72 "properties": { 73 "httpsOnly": true, 74 "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanPortalName'))]", 75 "siteConfig": { 76 "linuxFxVersion": "[parameters('linuxFxVersion')]", 77 "minTlsVersion": "1.2", 78 "ftpsState": "FtpsOnly" 79 } 80 }, 81 "identity": { 82 "type": "SystemAssigned" 83 }, 84 "dependsOn": [ 85 "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanPortalName'))]" 86 ] 87 }, 88 { 89 "condition": "[contains(parameters('repoUrl'), 'http')]", 90 "type": "Microsoft.Web/sites/sourcecontrols", 91 "apiVersion": "2021-02-01", 92 "name": "[format('{0}/{1}', parameters('webAppName'), 'web')]", 93 "properties": { 94 "repoUrl": "[parameters('repoUrl')]", 95 "branch": "master", 96 "isManualIntegration": true 97 }, 98 "dependsOn": [ 99 "[resourceId('Microsoft.Web/sites', parameters('webAppName'))]" 100 ] 101 } 102 ] 103} 104

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

こんにちは。

試してないのですが、以下を参考に Microsoft.Web/sites の siteConfig に appSettings を追加してみるとどうでしょうか。

https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites?pivots=deployment-language-bicep#siteconfig

NameValuePair でキーバリュー形式で設定出来るので、これが App Service コンソール上のアプリ設定かなと。

投稿2023/03/10 21:59

Tak1wa

総合スコア4791

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

nana_1107

2023/03/12 14:08

ご回答ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問