通过


你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

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 参数

名称 必需 类型 说明
portalConfigId
path True

string

minLength: 1
maxLength: 80

门户配置标识符。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 名称不区分大小写。

serviceName
path True

string

minLength: 1
maxLength: 50
pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

API 管理服务的名称。

subscriptionId
path True

string (uuid)

目标订阅的 ID。 该值必须是 UUID。

api-version
query True

string

minLength: 1

用于此作的 API 版本。

请求头

名称 必需 类型 说明
If-Match True

string

实体的 ETag。 ETag 应与 GET 请求的标头响应中的当前实体状态匹配,或者它应为 * 进行无条件更新。

请求正文

名称 类型 说明
properties.cors

PortalConfigCorsProperties

开发人员门户跨域资源共享(CORS)设置。

properties.csp

PortalConfigCspProperties

开发人员门户内容安全策略 (CSP) 设置。

properties.delegation

PortalConfigDelegationProperties

开发人员门户委派设置。

properties.enableBasicAuth

boolean

启用或禁用基本身份验证方法。

properties.signin

Signin

properties.signup

Signup

响应

名称 类型 说明
200 OK

PortalConfigContract

作已成功完成。

Other Status Codes

ErrorResponse

描述作失败的原因的错误响应。

安全性

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"
      ]
    }
  }
}

定义

名称 说明
ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

PortalConfigContract

开发人员门户配置协定。

PortalConfigCorsProperties

开发人员门户跨域资源共享(CORS)设置。

PortalConfigCspProperties

开发人员门户内容安全策略 (CSP) 设置。

PortalConfigDelegationProperties
PortalConfigTermsOfServiceProperties

服务条款协定属性。

PortalSettingsCspMode

开发人员门户内容安全策略(CSP)的模式。

Signin
Signup

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

PortalConfigContract

开发人员门户配置协定。

名称 类型 默认值 说明
id

string

资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

资源的名称

properties.cors

PortalConfigCorsProperties

开发人员门户跨域资源共享(CORS)设置。

properties.csp

PortalConfigCspProperties

开发人员门户内容安全策略 (CSP) 设置。

properties.delegation

PortalConfigDelegationProperties

开发人员门户委派设置。

properties.enableBasicAuth

boolean

True

启用或禁用基本身份验证方法。

properties.signin

Signin

properties.signup

Signup

type

string

资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

PortalConfigCorsProperties

开发人员门户跨域资源共享(CORS)设置。

名称 类型 说明
allowedOrigins

string[]

允许的源,例如 https://trusted.com

PortalConfigCspProperties

开发人员门户内容安全策略 (CSP) 设置。

名称 类型 默认值 说明
allowedSources

string[]

允许的源,例如 *.trusted.comtrusted.comhttps://

mode

PortalSettingsCspMode

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

PortalConfigTermsOfServiceProperties

服务条款设置。