共用方式為


PolicyAssignmentsOperations 類別

警告

請勿直接具現化此類別。

相反地,您應該透過 存取下列作業

PolicyClient's

<xref:policy_assignments> 屬性。

繼承
builtins.object
PolicyAssignmentsOperations

建構函式

PolicyAssignmentsOperations(*args, **kwargs)

方法

create

建立原則指派。

原則指派會由所有子資源繼承。 例如,當您將原則套用至資源群組時,該原則會指派給群組中的所有資源。

create_by_id

依識別碼建立原則指派。

原則指派會由所有子資源繼承。 例如,當您將原則套用至資源群組時,該原則會指派給群組中的所有資源。 為指派提供範圍時,請針對資源群組使用 '/subscriptions/{subscription-id}/{subscription-id}/resourceGroups/{resource-group-name}' 和 '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-type}/{resource-name}' 作為資源。

delete

刪除原則指派。

delete_by_id

依識別碼刪除原則指派。

為指派提供範圍時,請針對資源群組使用 '/subscriptions/{subscription-id}/{subscription-id}/resourceGroups/{resource-group-name}' 和 '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-type}/{resource-name}' 作為資源。

get

取得原則指派。

get_by_id

依識別碼取得原則指派。

為指派提供範圍時,請針對資源群組使用 '/subscriptions/{subscription-id}/{subscription-id}/resourceGroups/{resource-group-name}' 和 '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-type}/{resource-name}' 作為資源。

list

取得訂用帳戶的所有原則指派。

list_for_resource

取得資源的原則指派。

list_for_resource_group

取得資源群組的原則指派。

create

建立原則指派。

原則指派會由所有子資源繼承。 例如,當您將原則套用至資源群組時,該原則會指派給群組中的所有資源。

create(scope: str, policy_assignment_name: str, parameters: _models.PolicyAssignment, *, content_type: str = 'application/json', **kwargs: Any) -> _models.PolicyAssignment

參數

scope
str
必要

原則指派的範圍。 必要。

policy_assignment_name
str
必要

原則指派的名稱。 必要。

parameters
PolicyAssignmentIO
必要

原則指派的參數。 這是 PolicyAssignment 類型或 IO 類型。 必要。

content_type
str

Body 參數內容類型。 已知值為:'application/json'、'text/json'。 預設值為 [無]。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

PolicyAssignment 或 cls 的結果 (回應)

傳回類型

例外狀況

create_by_id

依識別碼建立原則指派。

原則指派會由所有子資源繼承。 例如,當您將原則套用至資源群組時,該原則會指派給群組中的所有資源。 為指派提供範圍時,請針對資源群組使用 '/subscriptions/{subscription-id}/{subscription-id}/resourceGroups/{resource-group-name}' 和 '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-type}/{resource-name}' 作為資源。

create_by_id(policy_assignment_id: str, parameters: _models.PolicyAssignment, *, content_type: str = 'application/json', **kwargs: Any) -> _models.PolicyAssignment

參數

policy_assignment_id
str
必要

要建立的原則指派識別碼。 使用格式 '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'。 必要。

parameters
PolicyAssignmentIO
必要

原則指派的參數。 這是 PolicyAssignment 類型或 IO 類型。 必要。

content_type
str

Body 參數內容類型。 已知值為:'application/json'、'text/json'。 預設值為 [無]。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

PolicyAssignment 或 cls 的結果 (回應)

傳回類型

例外狀況

delete

刪除原則指派。

delete(scope: str, policy_assignment_name: str, **kwargs: Any) -> PolicyAssignment | None

參數

scope
str
必要

原則指派的範圍。 必要。

policy_assignment_name
str
必要

要刪除的原則指派名稱。 必要。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

PolicyAssignment 或 None 或 cls (回應的結果)

傳回類型

例外狀況

delete_by_id

依識別碼刪除原則指派。

為指派提供範圍時,請針對資源群組使用 '/subscriptions/{subscription-id}/{subscription-id}/resourceGroups/{resource-group-name}' 和 '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-type}/{resource-name}' 作為資源。

delete_by_id(policy_assignment_id: str, **kwargs: Any) -> PolicyAssignment

參數

policy_assignment_id
str
必要

要刪除的原則指派識別碼。 使用格式 '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'。 必要。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

PolicyAssignment 或 cls 的結果 (回應)

傳回類型

例外狀況

get

取得原則指派。

get(scope: str, policy_assignment_name: str, **kwargs: Any) -> PolicyAssignment

參數

scope
str
必要

原則指派的範圍。 必要。

policy_assignment_name
str
必要

要取得的原則指派名稱。 必要。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

PolicyAssignment 或 cls 的結果 (回應)

傳回類型

例外狀況

get_by_id

依識別碼取得原則指派。

為指派提供範圍時,請針對資源群組使用 '/subscriptions/{subscription-id}/{subscription-id}/resourceGroups/{resource-group-name}' 和 '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-type}/{resource-name}' 作為資源。

get_by_id(policy_assignment_id: str, **kwargs: Any) -> PolicyAssignment

參數

policy_assignment_id
str
必要

要取得的原則指派識別碼。 使用格式 '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'。 必要。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

PolicyAssignment 或 cls 的結果 (回應)

傳回類型

例外狀況

list

取得訂用帳戶的所有原則指派。

list(filter: str | None = None, **kwargs: Any) -> Iterable[PolicyAssignment]

參數

filter
str
必要

要套用至作業的篩選。 預設值為 [無]。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

Iterator,例如 PolicyAssignment 實例或 cls 的結果 (回應)

傳回類型

例外狀況

list_for_resource

取得資源的原則指派。

list_for_resource(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, filter: str | None = None, **kwargs: Any) -> Iterable[PolicyAssignment]

參數

resource_group_name
str
必要

包含資源的資源組名。 名稱不區分大小寫。 必要。

resource_provider_namespace
str
必要

資源提供者的命名空間。 必要。

parent_resource_path
str
必要

父資源路徑。 必要。

resource_type
str
必要

資源類型。 必要。

resource_name
str
必要

具有原則指派的資源名稱。 必要。

filter
str
必要

要套用至作業的篩選。 預設值為 [無]。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

Iterator,例如 PolicyAssignment 實例或 cls 的結果 (回應)

傳回類型

例外狀況

list_for_resource_group

取得資源群組的原則指派。

list_for_resource_group(resource_group_name: str, filter: str | None = None, **kwargs: Any) -> Iterable[PolicyAssignment]

參數

resource_group_name
str
必要

包含原則指派的資源群組名稱。 必要。

filter
str
必要

要套用至作業的篩選。 預設值為 [無]。

cls
callable

將傳遞直接回應的自訂類型或函式

傳回

Iterator,例如 PolicyAssignment 實例或 cls 的結果 (回應)

傳回類型

例外狀況

屬性

models

models = <module 'azure.mgmt.resource.policy.v2016_12_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.7\\x64\\Lib\\site-packages\\azure\\mgmt\\resource\\policy\\v2016_12_01\\models\\__init__.py'>