Portal Config - Create Or Update
创建或更新开发人员门户配置。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}?api-version=2024-05-01
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
portal
|
path | True |
string minLength: 1maxLength: 80 |
门户配置标识符。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 名称不区分大小写。 |
|
service
|
path | True |
string minLength: 1maxLength: 50 pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$ |
API 管理服务的名称。 |
|
subscription
|
path | True |
string (uuid) |
目标订阅的 ID。 该值必须是 UUID。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
请求头
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| If-Match | True |
string |
实体的 ETag。 ETag 应与 GET 请求的标头响应中的当前实体状态匹配,或者它应为 * 进行无条件更新。 |
请求正文
| 名称 | 类型 | 说明 |
|---|---|---|
| properties.cors |
开发人员门户跨域资源共享(CORS)设置。 |
|
| properties.csp |
开发人员门户内容安全策略 (CSP) 设置。 |
|
| properties.delegation |
开发人员门户委派设置。 |
|
| properties.enableBasicAuth |
boolean |
启用或禁用基本身份验证方法。 |
| properties.signin | ||
| properties.signup |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
作已成功完成。 |
|
| Other Status Codes |
描述作失败的原因的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
ApiManagementCreatePortalConfig
示例请求
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalconfigs/default?api-version=2024-05-01
{
"properties": {
"enableBasicAuth": true,
"signin": {
"require": false
},
"signup": {
"termsOfService": {
"text": "I agree to the service terms and conditions.",
"requireConsent": false
}
},
"delegation": {
"delegateRegistration": false,
"delegateSubscription": false,
"delegationUrl": null,
"validationKey": null
},
"csp": {
"mode": "reportOnly",
"reportUri": [
"https://report.contoso.com"
],
"allowedSources": [
"*.contoso.com"
]
},
"cors": {
"allowedOrigins": [
"https://contoso.com"
]
}
}
}
示例响应
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalconfigs/default",
"type": "Microsoft.ApiManagement/service/portalconfigs",
"name": "default",
"properties": {
"enableBasicAuth": true,
"signin": {
"require": false
},
"signup": {
"termsOfService": {
"text": "I agree to the service terms and conditions.",
"requireConsent": false
}
},
"delegation": {
"delegateRegistration": false,
"delegateSubscription": false,
"delegationUrl": null,
"validationKey": null
},
"csp": {
"mode": "reportOnly",
"reportUri": [
"https://report.contoso.com"
],
"allowedSources": [
"*.contoso.com"
]
},
"cors": {
"allowedOrigins": [
"https://contoso.com"
]
}
}
}
定义
| 名称 | 说明 |
|---|---|
|
Error |
资源管理错误附加信息。 |
|
Error |
错误详细信息。 |
|
Error |
错误响应 |
|
Portal |
开发人员门户配置协定。 |
|
Portal |
开发人员门户跨域资源共享(CORS)设置。 |
|
Portal |
开发人员门户内容安全策略 (CSP) 设置。 |
|
Portal |
|
|
Portal |
服务条款协定属性。 |
|
Portal |
开发人员门户内容安全策略(CSP)的模式。 |
| Signin | |
| Signup |
ErrorAdditionalInfo
资源管理错误附加信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| info |
object |
其他信息。 |
| type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| additionalInfo |
错误附加信息。 |
|
| code |
string |
错误代码。 |
| details |
错误详细信息。 |
|
| message |
string |
错误消息。 |
| target |
string |
错误目标。 |
ErrorResponse
错误响应
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
PortalConfigContract
开发人员门户配置协定。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| id |
string |
资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
|
| name |
string |
资源的名称 |
|
| properties.cors |
开发人员门户跨域资源共享(CORS)设置。 |
||
| properties.csp |
开发人员门户内容安全策略 (CSP) 设置。 |
||
| properties.delegation |
开发人员门户委派设置。 |
||
| properties.enableBasicAuth |
boolean |
True |
启用或禁用基本身份验证方法。 |
| properties.signin | |||
| properties.signup | |||
| type |
string |
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
PortalConfigCorsProperties
开发人员门户跨域资源共享(CORS)设置。
| 名称 | 类型 | 说明 |
|---|---|---|
| allowedOrigins |
string[] |
允许的源,例如 |
PortalConfigCspProperties
开发人员门户内容安全策略 (CSP) 设置。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| allowedSources |
string[] |
允许的源,例如 |
|
| mode | disabled |
开发人员门户内容安全策略(CSP)的模式。 |
|
| reportUri |
string[] |
浏览器用于报告 CSP 冲突的 URL。 |
PortalConfigDelegationProperties
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| delegateRegistration |
boolean |
False |
启用或禁用用户注册的委派。 |
| delegateSubscription |
boolean |
False |
启用或禁用产品订阅的委派。 |
| delegationUrl |
string |
委派终结点 URL。 |
|
| validationKey |
string |
base64 编码的验证密钥,以确保请求源自 Azure API 管理服务。 |
PortalConfigTermsOfServiceProperties
服务条款协定属性。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| requireConsent |
boolean |
False |
要求用户同意服务条款。 |
| text |
string |
服务条款文本。 |
PortalSettingsCspMode
开发人员门户内容安全策略(CSP)的模式。
| 值 | 说明 |
|---|---|
| enabled |
浏览器将阻止与允许的源不匹配的请求。 |
| disabled |
浏览器不会应用源限制。 |
| reportOnly |
浏览器将报告请求与允许的源不匹配,而不会阻止它们。 |
Signin
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| require |
boolean |
False |
将匿名用户重定向到登录页。 |
Signup
| 名称 | 类型 | 说明 |
|---|---|---|
| termsOfService |
服务条款设置。 |