policy_assignments#

State module for managing Policy Assignments.

async idem_azure.states.azure.policy.policy_assignments.present(hub, ctx, name: str, scope: str, policy_assignment_name: str, policy_definition_id: str, parameters: Dict[str, Any] = None, resource_id: str = None) Dict[source]#

Create or update Policy Assignments.

Parameters:
  • name (str) – The identifier for this state.

  • scope (str) – The scope of the policy assignment. Valid scopes are: management group (format: ‘/providers/Microsoft.Management/managementGroups/{managementGroup}’), subscription (format: ‘/subscriptions/{subscriptionId}’), resource group (format: ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}’, or resource (format: ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}’.

  • policy_assignment_name (str) – The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created.

  • policy_definition_id (str) – The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created

  • parameters (dict[str, Any], Optional) – Policy assignment parameters with respect to policy definition rule. Defaults to {}.

  • resource_id (str, Optional) – Policy Assignment resource id on Azure

Returns:

dict

Examples

resource_is_present:
  azure.policy.policy_assignments.present:
    - name: value
    - scope: value
    - policy_assignment_name: value
    - policy_definition_id: value
async idem_azure.states.azure.policy.policy_assignments.absent(hub, ctx, name: str, scope: str, policy_assignment_name: str) dict[source]#

Delete Policy Assignment.

Parameters:
  • name (str) – The identifier for this state.

  • scope (str) – The scope of the policy assignment. Valid scopes are: management group (format: ‘/providers/Microsoft.Management/managementGroups/{managementGroup}’), subscription (format: ‘/subscriptions/{subscriptionId}’), resource group (format: ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}’, or resource (format: ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}’.

  • policy_assignment_name (str) – The name of the policy assignment to delete.

Returns:

dict

Examples

resource_is_absent:
  azure.policy.policy_assignments.absent:
    - name: value
    - scope: value
    - policy_assignment_name: value
async idem_azure.states.azure.policy.policy_assignments.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Lists all Policy Assignments under the same subscription.

Returns:

Dict[str, Any]

Examples

$ idem describe azure.policy.policy_assignments