【问题标题】:Create Azure Flask using Powershell使用 Powershell 创建 Azure Flask
【发布时间】:2017-07-02 14:42:58
【问题描述】:

我想使用 PowerShell 创建 Azure Flask,就像我们在 powershell 中创建 Web 应用程序一样(请参阅下文)。有什么命令可以做到这一点。

New-AzureRmWebApp -ResourceGroupName $WebAppResourceGroupName -Name $WebAppName -Location $WebAppLocation -AppServicePlan $WebAppServicePlanName

【问题讨论】:

  • 没有具体的命令,但我相信你可以用 Powershell 做到这一点,你也可以用 ARM 模板做到这一点
  • 你能举个例子吗

标签: azure flask azure-powershell


【解决方案1】:

这是一个用于部署 Flask 应用程序的 ARM 模板:

{
    "parameters": {
        "name": {
            "type": "string"
        },
        "hostingPlanName": {
            "type": "string"
        },
        "location": {
            "type": "string"
        },
        "hostingEnvironment": {
            "type": "string"
        },
        "serverFarmResourceGroup": {
            "type": "string"
        },
        "subscriptionId": {
            "type": "string"
        }
    },
    "resources": [
        {
            "name": "[parameters('name')]",
            "type": "Microsoft.Web/sites",
            "properties": {
                "siteConfig": {
                    "appSettings": []
                },
                "name": "[parameters('name')]",
                "serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
                "hostingEnvironment": "[parameters('hostingEnvironment')]"
            },
            "resources": [
                {
                    "apiVersion": "2016-03-01",
                    "name": "web",
                    "type": "sourcecontrols",
                    "dependsOn": [
                        "[resourceId('Microsoft.Web/Sites', parameters('name'))]"
                    ],
                    "properties": {
                        "RepoUrl": "https://github.com/azureappserviceoss/FlaskAzure",
                        "branch": "master",
                        "IsManualIntegration": true
                    }
                }
            ],
            "apiVersion": "2016-03-01",
            "location": "[parameters('location')]",
            "tags": {
                "[concat('hidden-related:', '/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "empty"
            }
        }
    ],
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0"
}

您可以将其存储在文件或 url 中并使用 New-AzureRMResourceGroupDeployment 调用它

【讨论】:

  • 我能够成功创建网络应用程序。但是当我浏览网络应用程序时我出错了
  • 运行时错误描述:服务器发生应用程序错误。此应用程序的当前自定义错误设置可防止远程查看应用程序错误的详细信息。但是,它可以被本地服务器机器上运行的浏览器查看。详细信息:要在远程计算机上查看此特定错误消息的详细信息,请在位于当前 Web 应用程序根目录的“web.config”配置文件中创建 标记。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-12-30
  • 2014-10-08
  • 1970-01-01
  • 1970-01-01
  • 2021-12-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多