Azure API 管理的 Microsoft.ApiManagement/service/portalsettings 和 Microsoft.ApiManagement/service/portalconfigs 资源有什么区别?
我想使用 Bicep 部署一些 Azure API 管理开发人员门户配置。其中一项是删除“用户名和密码”身份提供程序,因为我们将使用 Microsoft Entra Id。但我不知道该用什么。
我已手动删除身份提供程序,并注意到
enabled
资源(名称 portalsettings
)中的 signup
属性设置为 false
,并且 enableBasicAuth
资源中的 portalconfigs
属性为设置为 false
。
我在文档中找不到任何解释这两种资源之间差异的内容。
是的,Azure Api 管理服务中的
PortalSettings
和 PortalConfigs
之间存在细微差别。
Microsoft.Api管理/服务/门户设置:
这主要集中在用户帐户管理部分,例如开发人员门户上的登录和登录功能,启用或禁用用户注册的功能以及控制可用的用户身份验证方法,例如Azure AD等。
Microsoft.ApiManagement/service/portalconfigs:
这对开发者门户上的
configuration options
进行整体管理,并专注于身份验证,例如 enableBasicAuth
。
此外,此资源提供程序可用于设置禁用基本身份验证,通常在转换到替代身份验证方法时完成。 (您的场景)
注意到
资源(名称enabled
)中的portalsettings
属性设置为signup
,并且false
资源中的enableBasicAuth
属性设置为portalconfigs
:false
以上观察是正确的。
enabled
( false
) 中的 portalsettings
设置为 signup
将禁用用户通过开发者门户注册。enableBasicAuth
中的 false
设置为 portalconfigs
将禁用基本身份验证。我尝试了以下示例二头肌代码执行来执行门户设置(用户相关)行为,并成功,如图所示。
resource apima 'Microsoft.ApiManagement/service@2023-05-01-preview' existing= {
name: 'xxxapimgmt'
}
resource sett 'Microsoft.ApiManagement/service/portalsettings@2023-05-01-preview' = {
name: 'signin'
parent: apima
properties: {
enabled: true
}
}
我做了几个测试部署,它们实际上似乎重叠并相互影响。
例如:
enableBasicAuth
中启用 portalconfigs
属性,您还可以启用名称为 portalsettings
的 signup
,反之亦然。portalsettings
资源设置服务条款文本,您还可以在 portalconfigs
资源中配置服务条款文本,反之亦然。因此,部署以下二头肌将更新
portalsettings
资源以及 portalconfigs
资源:
resource portalsettingsSignin 'Microsoft.ApiManagement/service/portalsettings@2022-08-01' = {
name: 'signin'
parent: apimService
properties: {
enabled: true // also changes /portalconfigs/properties/signin/require
}
}
resource portalsettingsSignup 'Microsoft.ApiManagement/service/portalsettings@2022-08-01' = {
name: 'signup'
parent: apimService
properties: {
enabled: true // also changes /portalconfigs/properties/enableBasicAuth
termsOfService: {
consentRequired: true // also changes /portalconfigs/properties/signup/termsOfService/requireConsent
text: 'My Terms of Service' // also changes /portalconfigs/properties/signup/termsOfService/text
enabled: false // doesn't seem to change anything in /portalconfigs
}
}
}
下面的二头肌与上面的示例具有相同的效果:
resource protalconfigs 'Microsoft.ApiManagement/service/portalconfigs@2022-08-01' = {
name: 'default'
parent: apimService
properties: {
enableBasicAuth: true
signin: {
require: true
}
signup: {
termsOfService: {
requireConsent: true
text: 'My Terms of Service'
}
}
}
}