Azure 资源管理器 | Web App Slots 配置 |应用服务认证

Azure Resource Manager | Web App Slots Config | App Service Authentication

我上周通过 ADO 成功部署了我的 ARM 模板,但我意识到我忘记为我的 Web 应用程序插槽包含应用程序服务身份验证。

我在 Microsoft 上搞砸了。Web/sites/slots/config 和 运行 遇到了一些错误,在 Stack 上的几个人的帮助下我能够克服这些错误。

但是,现在代码应该可以工作了,但它失败了,但是我在发布时没有在 Azure DevOps 上收到任何错误代码。

它只是说;

2020-07-02T14:20:19.0820320Z ##[error]At least one resource deployment operation failed. Please 
list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
2020-07-02T14:20:19.0832558Z ##[error]Details:
2020-07-02T14:20:19.0834149Z ##[error]BadRequest: 
2020-07-02T14:20:19.0835776Z ##[error]Check out the troubleshooting guide to see if your issue is addressed: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
2020-07-02T14:20:19.0837268Z ##[error]Task failed while creating or updating the template deployment.

这是我的代码:

{
            "type": "Microsoft.Web/sites/slots/config",
            "name": "[concat(parameters('webAppName'),'/staging/auth')]",
            "apiVersion": "2018-11-01",
            "location": "[resourceGroup().location]",
            "dependsOn": [
                "[parameters('webAppName')]",
                "[concat(parameters('sqlDatabase'), 'constr')]"
            ],
             "properties": {
                "enabled": true,
                "runtimeVersion": "~1",
                "unauthenticatedClientAction": "RedirectToLoginPage",
                "tokenStoreEnabled": true,
                "allowedExternalRedirectUrls": null,
                "defaultProvider": "AzureActiveDirectory",
                "clientId": null,
                "clientSecret": null,
                "clientSecretCertificateThumbprint": null,
                "issuer": null,
                "allowedAudiences": [
                    "https://webapptest1a-staging.azurewebsites.net"
                ],
                "additionalLoginParams": null,
                "isAadAutoProvisioned": false,
                "googleClientId": null,
                "googleClientSecret": null,
                "googleOAuthScopes": null,
                "facebookAppId": null,
                "facebookAppSecret": null,
                "facebookOAuthScopes": [
                ""
                ],
                "twitterConsumerKey": null,
                "twitterConsumerSecret": null,
                "microsoftAccountClientId": null,
                "microsoftAccountClientSecret": null,
                "microsoftAccountOAuthScopes": [
                ""
                ]
                }
            },

有什么像拇指一样突出的东西吗?

我发布了没有这部分的代码,它运行良好,所以很可能是这里的这一小节引起了问题,但我认为所有信息都是正确的。

根据:https://docs.microsoft.com/en-us/azure/templates/microsoft.web/2019-08-01/sites/config-authsettings

感谢您的指导。

所以,过了一会儿我找到了答案;

这是工作代码;

我之前做的是这个;

"name": "[concat(parameters('webAppName'), '/staging/auth')]",

需要的是这个;

"name": "[concat(parameters('webAppName'), '/staging/authsettings')]",

单独的“auth”不会匹配任何东西,并且会返回一个错误的请求。这是正确的,因为“auth”下没有任何内容存在,这意味着它无法匹配。

因此,当您设置身份验证设置时,它实际上会按预期工作,因为它匹配!

Here is what i followed

{
            "type": "Microsoft.Web/sites/slots/config",
            "name": "[concat(parameters('webAppName'), '/staging/authsettings')]",
            "apiVersion": "2018-11-01",
            "location": "[resourceGroup().location]",
            "dependsOn": [
                "[parameters('webAppName')]",
                "[concat(parameters('sqlDatabase'), 'constr')]"
            ],
                    "properties": {
                    "enabled": true,
                    "runtimeVersion": "1.0.0",
                    "unauthenticatedClientAction": "RedirectToLoginPage",
                    "tokenStoreEnabled": false,
                    "allowedExternalRedirectUrls": null,
                    "defaultProvider":"AzureActiveDirectory",
                    "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": [
                    ""
                    ],
                    "twitterConsumerKey": null,
                    "twitterConsumerSecret": null,
                    "microsoftAccountClientId": null,
                    "microsoftAccountClientSecret": null,
                    "microsoftAccountOAuthScopes": [
                    ""
                    ]
                }
            },