gpt4 book ai didi

azure - 使用 ARM 模板在 Azure Function App 中轻松进行身份验证和授权

转载 作者:行者123 更新时间:2023-12-04 22:28:25 25 4
gpt4 key购买 nike

如果我手动配置,Azure 应用服务的“轻松身份验证和授权”功能可以在我的 Azure Function 应用程序中使用。当我使用 ARM 模板时它不起作用。

我使用此网站来计算配置值:https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.management.websites.models.siteauthsettings?view=azuremgmtwebsites-1.6.0-preview

这就是它的样子,想法吗?

编辑:在 https://resources.azure.com 检查结果配置后我看到“siteAuthEnabled”和“siteAuthSettings”根本不适用。是否应该在其他地方指定它们?

{
"apiVersion": "2016-08-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('webApiFunctionAppName')]",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('webApiFunctionAppHostingPlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('azFunctionsAppStorageAccountName'))]"
],
"resources": [{
"apiVersion": "2016-08-01",
"name": "[concat(parameters('webApiFunctionAppName'), '/authsettings')]",
"type": "Microsoft.Web/sites/config",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('webApiFunctionAppName'))]"
],
"properties": {
"netFrameworkVersion": "v4.0",
"managedPipelineMode": "Integrated",
"siteAuthEnabled": true,
"siteAuthSettings": {
"enabled": true,
"unauthenticatedClientAction": "RedirectToLoginPage",
"tokenStoreEnabled": true,
"allowedExternalRedirectUrls": null,
"defaultProvider": "AzureActiveDirectory",
"clientId": "[parameters('aadClientId')]",
"clientSecret": null,
"issuer": "[concat('https://sts.windows.net/', parameters('aadTenant'), '/')]",
"allowedAudiences": null,
"isAadAutoProvisioned": false
}
}
}],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('webApiFunctionAppHostingPlanName'))]",
"hostNameSslStates": [{
"name": "[concat(parameters('webApiFunctionAppName'),'.azurewebsites.net')]",
"sslState": "Disabled",
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"hostType": "Standard"
},
{
"name": "[concat(parameters('webApiFunctionAppName'),'.scm.azurewebsites.net')]",
"sslState": "Disabled",
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"hostType": "Repository"
}
],
"siteConfig": {
"appSettings": [{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('azFunctionsAppStorageAccountName'), ';AccountKey=', listKeys(variables('azFunctionAppStorageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('azFunctionsAppStorageAccountName'), ';AccountKey=', listKeys(variables('azFunctionAppStorageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~1"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('azFunctionsAppStorageAccountName'), ';AccountKey=', listKeys(variables('azFunctionAppStorageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower(parameters('webApiFunctionAppName'))]"
}
]
}
}
}

最佳答案

好的,明白了。该模板有效。

 {
"apiVersion": "2016-08-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('webApiFunctionAppName')]",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('webApiFunctionAppHostingPlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('azFunctionsAppStorageAccountName'))]"
],
"resources": [{
"name": "[concat(parameters('webApiFunctionAppName'), '/authsettings')]",
"apiVersion": "2016-08-01",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('webApiFunctionAppName'))]"
],
"properties": {
"enabled": true,
"unauthenticatedClientAction": "RedirectToLoginPage",
"tokenStoreEnabled": true,
"defaultProvider": "AzureActiveDirectory",
"clientId": "[parameters('aadClientId')]",
"issuer": "[concat('https://sts.windows.net/', parameters('aadTenant'), '/')]"
}
}],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('webApiFunctionAppHostingPlanName'))]",
"hostNameSslStates": [{
"name": "[concat(parameters('webApiFunctionAppName'),'.azurewebsites.net')]",
"sslState": "Disabled",
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"hostType": "Standard"
},
{
"name": "[concat(parameters('webApiFunctionAppName'),'.scm.azurewebsites.net')]",
"sslState": "Disabled",
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"hostType": "Repository"
}
],
"siteConfig": {
"appSettings": [{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('azFunctionsAppStorageAccountName'), ';AccountKey=', listKeys(variables('azFunctionAppStorageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('azFunctionsAppStorageAccountName'), ';AccountKey=', listKeys(variables('azFunctionAppStorageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~1"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('azFunctionsAppStorageAccountName'), ';AccountKey=', listKeys(variables('azFunctionAppStorageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower(parameters('webApiFunctionAppName'))]"
}
]
}
}
}

关于azure - 使用 ARM 模板在 Azure Function App 中轻松进行身份验证和授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45268658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com