繁体   English   中英

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

[英]Azure Resource Manager: Web App Slots Config: App Service Authentication

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

我收到的错误如下:

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

这是我的代码,我认为这是非常正确的。 我发现很难找到 Web App 插槽配置的参考。 我有 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
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM