【问题标题】:Web App created from ARM template - can't disconnect deployment从 ARM 模板创建的 Web 应用程序 - 无法断开部署
【发布时间】:2019-03-07 03:55:37
【问题描述】:

我使用改编自 Azure 门户上生成的模板以及同样来自 azure 门户的 powershell 脚本创建了一个 Web 应用、应用计划和资源组。

它无法链接到我的 bitbucket 存储库或安装扩展程序,但其他方面都成功。

但是,如果我尝试在部署中心断开我的部署以手动连接到 Bitbucket,它只会显示三个点繁忙的动画,但永远不会完成。见附件截图:

下面是我的 template.json(是的,我知道这是一团糟,我还在学习!):

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "sites_webapp_name": {
            "defaultValue": "cdg-grav-demo01",
            "type": "String"
        },
        "serverfarms_appplan_name": {
            "defaultValue": "cus-box-appplan",
            "type": "String"
        },
        "config_web_name": {
            "defaultValue": "web",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "comments": "Serverfarm Size",
            "type": "Microsoft.Web/serverfarms",
            "sku": {
                "name": "F1",
                "tier": "Free",
                "size": "F1",
                "family": "F",
                "capacity": 0
            },
            "kind": "app",
            "name": "[parameters('serverfarms_appplan_name')]",
            "apiVersion": "2016-09-01",
            "location": "Central US",
            "scale": null,
            "properties": {
                "name": "[parameters('serverfarms_appplan_name')]",
                "workerTierName": null,
                "adminSiteName": null,
                "hostingEnvironmentProfile": null,
                "perSiteScaling": false,
                "reserved": false,
                "targetWorkerCount": 0,
                "targetWorkerSizeId": 0
            },
            "dependsOn": []
        },
        {
            "comments": "Site Parameters",
            "type": "Microsoft.Web/sites",
            "kind": "app",
            "name": "[parameters('sites_webapp_name')]",
            "apiVersion": "2016-08-01",
            "location": "Central US",
            "scale": null,
            "properties": {
                "enabled": true,
                "hostNameSslStates": [
                    {
                        "name": "[concat(parameters('sites_webapp_name'),'.azurewebsites.net')]",
                        "sslState": "Disabled",
                        "virtualIP": null,
                        "thumbprint": null,
                        "toUpdate": null,
                        "hostType": "Standard"
                    },
                    {
                        "name": "[concat(parameters('sites_webapp_name'),'.scm.azurewebsites.net')]",
                        "sslState": "Disabled",
                        "virtualIP": null,
                        "thumbprint": null,
                        "toUpdate": null,
                        "hostType": "Repository"
                    }
                ],
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_appplan_name'))]",
                "reserved": false,
                "siteConfig": null,
                "scmSiteAlsoStopped": false,
                "hostingEnvironmentProfile": null,
                "clientAffinityEnabled": true,
                "clientCertEnabled": false,
                "hostNamesDisabled": false,
                "containerSize": 0,
                "dailyMemoryTimeQuota": 0,
                "cloningInfo": null,
                "httpsOnly": true
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_appplan_name'))]"
            ]
        },
        {
            "comments": "Site Settings",
            "type": "Microsoft.Web/sites/config",
            "name": "[concat(parameters('sites_webapp_name'), '/', parameters('config_web_name'))]",
            "apiVersion": "2016-08-01",
            "location": "Central US",
            "scale": null,
            "properties": {
                "numberOfWorkers": 1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php",
                    "hostingstart.html"
                ],
                "netFrameworkVersion": "v4.0",
                "phpVersion": "7.2",
                "pythonVersion": "",
                "nodeVersion": "",
                "linuxFxVersion": "",
                "windowsFxVersion": null,
                "requestTracingEnabled": false,
                "remoteDebuggingEnabled": false,
                "remoteDebuggingVersion": "VS2017",
                "httpLoggingEnabled": false,
                "logsDirectorySizeLimit": 35,
                "detailedErrorLoggingEnabled": false,
                "publishingUsername": "[concat('$',parameters('sites_webapp_name'))]",
                "publishingPassword": null,
                "appSettings": null,
                "azureStorageAccounts": {},
                "metadata": null,
                "connectionStrings": null,
                "machineKey": null,
                "handlerMappings": null,
                "documentRoot": null,
                "scmType": "BitbucketGit",
                "use32BitWorkerProcess": true,
                "webSocketsEnabled": false,
                "alwaysOn": false,
                "javaVersion": null,
                "javaContainer": null,
                "javaContainerVersion": null,
                "appCommandLine": "",
                "managedPipelineMode": "Integrated",
                "virtualApplications": [
                    {
                        "virtualPath": "/",
                        "physicalPath": "site\\wwwroot",
                        "preloadEnabled": false,
                        "virtualDirectories": null
                    }
                ],
                "winAuthAdminState": 0,
                "winAuthTenantState": 0,
                "customAppPoolIdentityAdminState": false,
                "customAppPoolIdentityTenantState": false,
                "runtimeADUser": null,
                "runtimeADUserPassword": null,
                "loadBalancing": "LeastRequests",
                "routingRules": [],
                "experiments": {
                    "rampUpRules": []
                },
                "limits": null,
                "autoHealEnabled": false,
                "autoHealRules": null,
                "tracingOptions": null,
                "vnetName": "",
                "siteAuthEnabled": false,
                "siteAuthSettings": {
                    "enabled": null,
                    "unauthenticatedClientAction": null,
                    "tokenStoreEnabled": null,
                    "allowedExternalRedirectUrls": null,
                    "defaultProvider": null,
                    "clientId": null,
                    "clientSecret": null,
                    "clientSecretCertificateThumbprint": null,
                    "issuer": null,
                    "allowedAudiences": null,
                    "additionalLoginParams": null,
                    "isAadAutoProvisioned": false,
                    "googleClientId": null,
                    "googleClientSecret": null,
                    "googleOAuthScopes": null,
                    "facebookAppId": null,
                    "facebookAppSecret": null,
                    "facebookOAuthScopes": null,
                    "twitterConsumerKey": null,
                    "twitterConsumerSecret": null,
                    "microsoftAccountClientId": null,
                    "microsoftAccountClientSecret": null,
                    "microsoftAccountOAuthScopes": null
                },
                "cors": null,
                "push": null,
                "apiDefinition": null,
                "autoSwapSlotName": null,
                "localMySqlEnabled": false,
                "managedServiceIdentityId": null,
                "xManagedServiceIdentityId": null,
                "ipSecurityRestrictions": null,
                "scmIpSecurityRestrictions": null,
                "scmIpSecurityRestrictionsUseMain": null,
                "http20Enabled": true,
                "minTlsVersion": "1.2",
                "ftpsState": "FtpsOnly",
                "reservedInstanceCount": 0
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_webapp_name'))]"
            ]
        },
        {
            "comments": "Source Control",
            "name": "[concat(parameters('sites_webapp_name'),'/SourceControl')]",
            "type": "Microsoft.Web/sites/sourcecontrols",
            "apiVersion": "2016-08-01",
            "location": "Central US",
            "properties": {
              "repoUrl": "https://bitbucket.org/goldjg/cirrius-tech-blog",
              "branch": "develop",
              "isManualIntegration": false,
              "deploymentRollbackEnabled": false,
              "isMercurial": false,
              "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_webapp_name'))]"
            ]
            }
          },
          {
            "comments": "Site Extensions",
            "name": "[concat(parameters('sites_webapp_name'),'/ComposerExtension')]",
            "type": "Microsoft.Web/sites/siteextensions",
            "apiVersion": "2016-08-01",
            "location": "Central US",
            "properties": {
              "id": "ComposerExtension",
              "title": "Composer",
              "type": "Gallery",
              "extension_url": "[concat('https://',parameters('sites_webapp_name'),'.scm.azurewebsites.net/Composer/')]",
              "project_url": "https://github.com/SyntaxC4-MSFT/ComposerExtension",
              "icon_url": "http://www.siteextensions.net/Content/Images/packageDefaultIcon.png",
              "license_url": "http://opensource.org/licenses/MIT",
              "feed_url": null,
              "installer_command_line_params": null,
              "published_date_time": null,
              "local_path": "D:\\home\\SiteExtensions\\ComposerExtension",
              "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_webapp_name'))]"
            ]
            }
          }
    ]
}

这是我的 parameters.json 文件:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "sites_webapp_name": {
            "value": "IAC-DEMO-01"
        },
        "serverfarms_appplan_name": {
            "value": "IACDEMO-Appplan"
        },
        "config_web_name": {
            "value": "web"
        }
    }
}

【问题讨论】:

    标签: azure-resource-manager


    【解决方案1】:

    在这种情况下,您必须按照以下步骤断开部署。

    1. 转到https://resources.azure.com/,即转到您在 Azure 门户中新创建的应用服务资源,然后单击“资源浏览器”磁贴。
    2. 现在在资源浏览器中,转到 config -> web。
    3. 确保您处于“读/写”模式而不是“只读”模式。
    4. 单击“编辑”以更新“网络”JSON 文件。
    5. 现在将“scmType”键的值更改为“None”。
    6. 点击“PUT”。

    关于失败部分的说明是,AFAIK 您的模板未能链接 bitbucket 存储库,因为它找不到您的 bitbucket 存储库的源代码控制令牌。

    希望这会有所帮助!!干杯!!

    【讨论】:

    • 这很奏效——并把我介绍给了资源浏览器——这真的很有用!出于兴趣,我将如何在 ARM 模板中定义源代码管理令牌?
    • 对于像 Bitbucket / GitHub 这样的外部存储库来说,您的问题的答案有点棘手。
    • 为简单起见,您可以首先使用 Azure 门户授权 bitbucket 部署至少一次以建立关系,即,实际上要设置持续部署,需要一个 oauth 令牌来调用 GitHub/Bitbucket api .此令牌在门户上的 OAuth 同意流期间提供给 Azure。如果您遇到此问题,请尝试登录到门户 (portal.azure.com) 并执行一次设置持续部署(到任何站点)。 oauth 令牌将为登录 Azure 用户存储。每个 Azure 用户都需要通过 OAuth 同意流程一次。
    • 欲了解更多信息和参考,请查看以下 URL。 github.com/projectkudu/kudu/wiki/…stackoverflow.com/questions/33239397/…github.com/projectkudu/kudu/wiki/… 同样,我希望此更新对您有所帮助!干杯!!
    • 优秀 - 看看我的表现。即使我无法通过 ARM 模板完成源代码控制和扩展,通过模板完成其余的工作仍然是一个巨大的帮助,而且这一点似乎已经好了 :-)
    猜你喜欢
    • 2020-08-23
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 2019-12-21
    • 1970-01-01
    相关资源
    最近更新 更多