azure“az webapp up”是否运行构建过程?

azure“az webapp up”是否运行构建过程?

目前,我正在编写一个在 Microsoft Azure 云上运行的 Django(python)应用程序。 Azure 提供了几种不同的方式来部署您的应用程序:

  1. Zip 上传
  2. Git 存储库
  3. Cloud Shell 使用“az webapp up“ 命令

在里面文档中提到,构建过程可以配置为在部署期间自动运行(在本例中,运行 pip install -r requirements.txt)。但是,对于第三个选项,没有提及这一点。

有人可以解释一下这个问题吗?

答案1

由于它被列为“实验命令”,因此最好的文档选择是手册页。

$>az webapp up --help

Command
    az webapp up : (Preview) Create and deploy existing local code to the web app, by running the
    command from the folder where the code is present. Supports running the command in preview mode
    using --dryrun parameter. Current supports includes Node, Python,.NET Core, ASP.NET, staticHtml.
    Node, Python apps are created as Linux apps. .Net Core, ASP.NET and static HTML apps are created
    as Windows apps. If command is run from an empty folder, an empty windows web app is created.

Arguments
    --dryrun       : Show summary of the create and deploy operation instead of executing it.
    --location -l  : Location. Values from: `az account list-locations`. You can configure the
                     default location using `az configure --defaults location=<location>`.
    --sku          : The pricing tiers, e.g., F1(Free), D1(Shared), B1(Basic Small), B2(Basic
                     Medium), B3(Basic Large), S1(Standard Small), P1(Premium Small), P1V2(Premium
                     V2 Small), PC2 (Premium Container Small), PC3 (Premium Container Medium), PC4
                     (Premium Container Large).  Allowed values: B1, B2, B3, D1, F1, FREE, P1, P1V2,
                     P2, P2V2, P3, P3V2, PC2, PC3, PC4, S1, S2, S3, SHARED.

Resource Id Arguments
    --ids          : One or more resource IDs (space-delimited). If provided, no other 'Resource Id'
                     arguments should be specified.
    --name -n      : Name of the web app. You can configure the default using 'az configure
                     --defaults web=<name>'.
    --subscription : Name or ID of subscription. You can configure the default subscription using
                     `az account set -s NAME_OR_ID`.

Global Arguments
    --debug        : Increase logging verbosity to show all debug logs.
    --help -h      : Show this help message and exit.
    --output -o    : Output format.  Allowed values: json, jsonc, none, table, tsv, yaml.  Default:
                     json.
    --query        : JMESPath query string. See http://jmespath.org/ for more information and
                     examples.
    --verbose      : Increase logging verbosity. Use --debug for full debug logs.

Examples
    View the details of the app that will be created, without actually running the operation
        az webapp up -n MyUniqueAppName --dryrun


    Create a web app with the default configuration, by running the command from the folder where
    the code to deployed exists.
        az webapp up -n MyUniqueAppName


    Create a web app in a sepcific region, by running the command from the folder where the code to
    deployed exists.
        az webapp up -n MyUniqueAppName -l locationName


    Deploy new code to an app that was originally created using the same command
        az webapp up -n MyUniqueAppName -l locationName

答案2

TL:DR 在部署之前运行这个 az webapp config appsettings set -g MyResourceGroup -n MyUniqueAppName --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true

PS C:\> az webapp config appsettings set --h

Command
    az webapp config appsettings set : Set a web app's settings.

Arguments
    --settings          : Space-separated appsettings in a format of <name>=<value>.
    --slot -s           : The name of the slot. Default to the productions slot if not specified.
    --slot-settings     : Space-separated slot appsettings in a format of <name>=<value>.

Resource Id Arguments
    --ids               : One or more resource IDs (space-delimited). If provided, no other
                          'Resource Id' arguments should be specified.
    --name -n           : Name of the webapp. You can configure the default using 'az configure
                          --defaults web=<name>'.
    --resource-group -g : Name of resource group. You can configure the default group using `az
                          configure --defaults group=<name>`.  Default: AvidX-Dv-BIOps-RG.
    --subscription      : Name or ID of subscription. You can configure the default subscription
                          using `az account set -s NAME_OR_ID`.

Global Arguments
    --debug             : Increase logging verbosity to show all debug logs.
    --help -h           : Show this help message and exit.
    --output -o         : Output format.  Allowed values: json, jsonc, none, table, tsv, yaml.
                          Default: json.
    --query             : JMESPath query string. See http://jmespath.org/ for more information and
                          examples.
    --verbose           : Increase logging verbosity. Use --debug for full debug logs.

相关内容