共用方式為


Policy Restriction - Create Or Update

建立或更新 Api 管理服務的原則限制設定。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}?api-version=2024-05-01

URI 參數

名稱 位於 必要 類型 Description
policyRestrictionId
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)

目標訂用帳戶的標識碼。 此值必須是 UUID。

api-version
query True

string

minLength: 1

要用於這項作業的 API 版本。

要求標頭

名稱 必要 類型 Description
If-Match

string

實體的 ETag。 建立實體時不需要,但在更新實體時則為必要專案。

要求本文

名稱 類型 Description
properties.requireBase

PolicyRestrictionRequireBase

指出是否應針對原則文件強制執行基底原則。

properties.scope

string

原則文件的路徑。

回應

名稱 類型 Description
200 OK

PolicyRestrictionContract

已成功更新 Api 管理服務的原則限制設定。

標題

ETag: string

201 Created

PolicyRestrictionContract

已成功建立原則限制設定。

標題

ETag: string

Other Status Codes

ErrorResponse

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

ApiManagementCreatePolicyRestriction

範例要求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyRestrictions/policyRestriction1?api-version=2024-05-01


{
  "properties": {
    "scope": "Sample Path to the policy document.",
    "requireBase": "true"
  }
}

範例回覆

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyRestrictions/policyRestriction1",
  "type": "Microsoft.ApiManagement/service/policyFragments",
  "name": "policyRestrictions1",
  "properties": {
    "scope": "Sample Path to the policy document.",
    "requireBase": "true"
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyRestrictions/policyRestriction1",
  "type": "Microsoft.ApiManagement/service/policyFragments",
  "name": "policyRestrictions2",
  "properties": {
    "scope": "Sample Path to the policy document.",
    "requireBase": "true"
  }
}

定義

名稱 Description
ErrorAdditionalInfo

資源管理錯誤其他資訊。

ErrorDetail

錯誤詳細數據。

ErrorResponse

錯誤回應

PolicyRestrictionContract

原則限制合約詳細數據。

PolicyRestrictionRequireBase

指出是否應針對原則文件強制執行基底原則。

ErrorAdditionalInfo

資源管理錯誤其他資訊。

名稱 類型 Description
info

object

其他資訊。

type

string

其他信息類型。

ErrorDetail

錯誤詳細數據。

名稱 類型 Description
additionalInfo

ErrorAdditionalInfo[]

錯誤其他資訊。

code

string

錯誤碼。

details

ErrorDetail[]

錯誤詳細數據。

message

string

錯誤訊息。

target

string

錯誤目標。

ErrorResponse

錯誤回應

名稱 類型 Description
error

ErrorDetail

error 物件。

PolicyRestrictionContract

原則限制合約詳細數據。

名稱 類型 預設值 Description
id

string

資源的完整資源標識碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

資源的名稱

properties.requireBase

PolicyRestrictionRequireBase

false

指出是否應針對原則文件強制執行基底原則。

properties.scope

string

原則文件的路徑。

type

string

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

PolicyRestrictionRequireBase

指出是否應針對原則文件強制執行基底原則。

Description
false

原則不需要有基底原則

true

原則必須有基底原則