Azure 资源管理器:Web 应用槽配置:应用服务身份验证

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

我在将应用服务身份验证应用于我的 Web 应用槽时遇到问题。

我收到的错误如下:

“类型 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Common.Entities.TemplateGenericProperty`1[System.String]' 的模板资源 'webapptest1a/authconfig' 在行 '1' 和列 '8107' 的段长度不正确。嵌套的资源类型必须具有相同数量的段作为其资源名称。根资源类型的段长度必须比其资源名称大一

这是我的代码,我认为它非常正确。我发现很难找到 Web 应用程序插槽配置的参考。我有 Microsoft 文档并遵循了它,但运气不好。

这是我的代码:

{
        "type": "Microsoft.Web/sites/slots/config",
        "name": "[concat(parameters('webAppName'),'/authconfig')]",
        "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": [
            ""
            ]
            }
        },

我真的很震惊,我尝试了很多变体,但我没有接近。

我将名称更改为几个不同的变体,然后我得到了不同的错误,但关于命名约定。

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

我也把Depends on改了两次从:

"[parameters('webAppName')]",
                "[concat(parameters('sqlDatabase'), 'constr')]"

收件人:

"[concat('Microsoft.Web/sites/', parameters('webAppName'))]",
            "[concat(parameters('sqlDatabase'), 'constr')]"

我真的卡住了!希望得到一些指导。

谢谢

如错误所述“根级别资源的名称中必须比资源类型少一个段”。您在这里传递的资源名称不正确。由于 Type 的段长度为 4,Name 的段长度必须为 3。因此在配置名称中,您还必须传递插槽名称如下所示(您可以根据您的模板更改插槽名称和配置名称)

[concat(parameters('webAppName'), '/staging/web')]

请查看以下示例以供参考:

{
    "type": "Microsoft.Web/sites/slots/config",
    "apiVersion": "2018-11-01",
    "name": "[concat(parameters('webAppName'), '/staging/web')]",
    "location": "East US",
    "dependsOn": [
        "[resourceId('Microsoft.Web/sites/slots', parameters('webAppName'), 'staging')]",
        "[resourceId('Microsoft.Web/sites', parameters('webAppName'))]"
    ],
    "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",
        "requestTracingEnabled": false,
        "remoteDebuggingEnabled": false,
        "remoteDebuggingVersion": "VS2019",
        "httpLoggingEnabled": false,
        "logsDirectorySizeLimit": 35,
        "detailedErrorLoggingEnabled": false,
        "publishingUsername": "$mytestap345__staging",
        "scmType": "None",
        "use32BitWorkerProcess": true,
        "webSocketsEnabled": false,
        "alwaysOn": false,
        "managedPipelineMode": "Integrated",
        "virtualApplications": [
            {
                "virtualPath": "/",
                "physicalPath": "site\wwwroot",
                "preloadEnabled": false
            }
        ],
        "loadBalancing": "LeastRequests",
        "experiments": {
            "rampUpRules": []
        },
        "autoHealEnabled": false,
        "localMySqlEnabled": false,
        "ipSecurityRestrictions": [
            {
                "ipAddress": "Any",
                "action": "Allow",
                "priority": 1,
                "name": "Allow all",
                "description": "Allow all access"
            }
        ],
        "scmIpSecurityRestrictions": [
            {
                "ipAddress": "Any",
                "action": "Allow",
                "priority": 1,
                "name": "Allow all",
                "description": "Allow all access"
            }
        ],
        "scmIpSecurityRestrictionsUseMain": false,
        "http20Enabled": false,
        "minTlsVersion": "1.2",
        "ftpsState": "AllAllowed",
        "reservedInstanceCount": 0
    }
}