salt.modules.azurearm_resource

Azure (ARM) Resource Execution Module

New in version 2019.2.0.

Warning

This cloud provider will be removed from Salt in version 3007 in favor of the saltext.azurerm Salt Extension

maintainer

<devops@eitr.tech>

maturity

new

depends
platform

linux

configuration

This module requires Azure Resource Manager credentials to be passed as keyword arguments to every function in order to work properly.

Required provider parameters:

if using username and password:
  • subscription_id

  • username

  • password

if using a service principal:
  • subscription_id

  • tenant

  • client_id

  • secret

Optional provider parameters:

cloud_environment: Used to point the cloud driver to different API endpoints, such as Azure GovCloud.
Possible values:
  • AZURE_PUBLIC_CLOUD (default)

  • AZURE_CHINA_CLOUD

  • AZURE_US_GOV_CLOUD

  • AZURE_GERMAN_CLOUD

salt.modules.azurearm_resource.deployment_cancel(name, resource_group, **kwargs)

New in version 2019.2.0.

Cancel a deployment if in 'Accepted' or 'Running' state.

Parameters
  • name -- The name of the deployment to cancel.

  • resource_group -- The resource group name assigned to the deployment.

CLI Example:

salt-call azurearm_resource.deployment_cancel testdeploy testgroup
salt.modules.azurearm_resource.deployment_check_existence(name, resource_group, **kwargs)

New in version 2019.2.0.

Check the existence of a deployment.

Parameters
  • name -- The name of the deployment to query.

  • resource_group -- The resource group name assigned to the deployment.

CLI Example:

salt-call azurearm_resource.deployment_check_existence testdeploy testgroup
salt.modules.azurearm_resource.deployment_create_or_update(name, resource_group, deploy_mode='incremental', debug_setting='none', deploy_params=None, parameters_link=None, deploy_template=None, template_link=None, **kwargs)

New in version 2019.2.0.

Deploys resources to a resource group.

Parameters
  • name -- The name of the deployment to create or update.

  • resource_group -- The resource group name assigned to the deployment.

  • deploy_mode -- The mode that is used to deploy resources. This value can be either 'incremental' or 'complete'. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.

  • debug_setting -- The debug setting of the deployment. The permitted values are 'none', 'requestContent', 'responseContent', or 'requestContent,responseContent'. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations.

  • deploy_params -- JSON string containing name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parameters_link property or the deploy_params property, but not both.

  • parameters_link -- The URI of a parameters file. You use this element to link to an existing parameters file. Use either the parameters_link property or the deploy_params property, but not both.

  • deploy_template -- JSON string of template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. Use either the template_link property or the deploy_template property, but not both.

  • template_link -- The URI of the template. Use either the template_link property or the deploy_template property, but not both.

CLI Example:

salt-call azurearm_resource.deployment_create_or_update testdeploy testgroup
salt.modules.azurearm_resource.deployment_delete(name, resource_group, **kwargs)

New in version 2019.2.0.

Delete a deployment.

Parameters
  • name -- The name of the deployment to delete.

  • resource_group -- The resource group name assigned to the deployment.

CLI Example:

salt-call azurearm_resource.deployment_delete testdeploy testgroup
salt.modules.azurearm_resource.deployment_export_template(name, resource_group, **kwargs)

New in version 2019.2.0.

Exports the template used for the specified deployment.

Parameters
  • name -- The name of the deployment to query.

  • resource_group -- The resource group name assigned to the deployment.

CLI Example:

salt-call azurearm_resource.deployment_export_template testdeploy testgroup
salt.modules.azurearm_resource.deployment_get(name, resource_group, **kwargs)

New in version 2019.2.0.

Get details about a specific deployment.

Parameters
  • name -- The name of the deployment to query.

  • resource_group -- The resource group name assigned to the deployment.

CLI Example:

salt-call azurearm_resource.deployment_get testdeploy testgroup
salt.modules.azurearm_resource.deployment_operation_get(operation, deployment, resource_group, **kwargs)

New in version 2019.2.0.

Get a deployment operation within a deployment.

Parameters
  • operation -- The operation ID of the operation within the deployment.

  • deployment -- The name of the deployment containing the operation.

  • resource_group -- The resource group name assigned to the deployment.

CLI Example:

salt-call azurearm_resource.deployment_operation_get XXXXX testdeploy testgroup
salt.modules.azurearm_resource.deployment_operations_list(name, resource_group, result_limit=10, **kwargs)

New in version 2019.2.0.

List all deployment operations within a deployment.

Parameters
  • name -- The name of the deployment to query.

  • resource_group -- The resource group name assigned to the deployment.

  • result_limit -- (Default: 10) The limit on the list of deployment operations.

CLI Example:

salt-call azurearm_resource.deployment_operations_list testdeploy testgroup
salt.modules.azurearm_resource.deployment_validate(name, resource_group, deploy_mode=None, debug_setting=None, deploy_params=None, parameters_link=None, deploy_template=None, template_link=None, **kwargs)

New in version 2019.2.0.

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.

Parameters
  • name -- The name of the deployment to validate.

  • resource_group -- The resource group name assigned to the deployment.

  • deploy_mode -- The mode that is used to deploy resources. This value can be either 'incremental' or 'complete'. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.

  • debug_setting -- The debug setting of the deployment. The permitted values are 'none', 'requestContent', 'responseContent', or 'requestContent,responseContent'. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations.

  • deploy_params -- JSON string containing name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parameters_link property or the deploy_params property, but not both.

  • parameters_link -- The URI of a parameters file. You use this element to link to an existing parameters file. Use either the parameters_link property or the deploy_params property, but not both.

  • deploy_template -- JSON string of template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. Use either the template_link property or the deploy_template property, but not both.

  • template_link -- The URI of the template. Use either the template_link property or the deploy_template property, but not both.

CLI Example:

salt-call azurearm_resource.deployment_validate testdeploy testgroup
salt.modules.azurearm_resource.deployments_list(resource_group, **kwargs)

New in version 2019.2.0.

List all deployments within a resource group.

CLI Example:

salt-call azurearm_resource.deployments_list testgroup
salt.modules.azurearm_resource.policy_assignment_create(name, scope, definition_name, **kwargs)

New in version 2019.2.0.

Create a policy assignment.

Parameters
  • name -- The name of the policy assignment to create.

  • scope -- The scope of the policy assignment.

  • definition_name -- The name of the policy definition to assign.

CLI Example:

salt-call azurearm_resource.policy_assignment_create testassign         /subscriptions/bc75htn-a0fhsi-349b-56gh-4fghti-f84852 testpolicy
salt.modules.azurearm_resource.policy_assignment_delete(name, scope, **kwargs)

New in version 2019.2.0.

Delete a policy assignment.

Parameters
  • name -- The name of the policy assignment to delete.

  • scope -- The scope of the policy assignment.

CLI Example:

salt-call azurearm_resource.policy_assignment_delete testassign         /subscriptions/bc75htn-a0fhsi-349b-56gh-4fghti-f84852
salt.modules.azurearm_resource.policy_assignment_get(name, scope, **kwargs)

New in version 2019.2.0.

Get details about a specific policy assignment.

Parameters
  • name -- The name of the policy assignment to query.

  • scope -- The scope of the policy assignment.

CLI Example:

salt-call azurearm_resource.policy_assignment_get testassign         /subscriptions/bc75htn-a0fhsi-349b-56gh-4fghti-f84852
salt.modules.azurearm_resource.policy_assignments_list(**kwargs)

New in version 2019.2.0.

List all policy assignments for a subscription.

CLI Example:

salt-call azurearm_resource.policy_assignments_list
salt.modules.azurearm_resource.policy_assignments_list_for_resource_group(resource_group, **kwargs)

New in version 2019.2.0.

List all policy assignments for a resource group.

Parameters

resource_group -- The resource group name to list policy assignments within.

CLI Example:

salt-call azurearm_resource.policy_assignments_list_for_resource_group testgroup
salt.modules.azurearm_resource.policy_definition_create_or_update(name, policy_rule, **kwargs)

New in version 2019.2.0.

Create or update a policy definition.

Parameters
  • name -- The name of the policy definition to create or update.

  • policy_rule -- A dictionary defining the policy rule.

CLI Example:

salt-call azurearm_resource.policy_definition_create_or_update testpolicy '{...rule definition..}'
salt.modules.azurearm_resource.policy_definition_delete(name, **kwargs)

New in version 2019.2.0.

Delete a policy definition.

Parameters

name -- The name of the policy definition to delete.

CLI Example:

salt-call azurearm_resource.policy_definition_delete testpolicy
salt.modules.azurearm_resource.policy_definition_get(name, **kwargs)

New in version 2019.2.0.

Get details about a specific policy definition.

Parameters

name -- The name of the policy definition to query.

CLI Example:

salt-call azurearm_resource.policy_definition_get testpolicy
salt.modules.azurearm_resource.policy_definitions_list(hide_builtin=False, **kwargs)

New in version 2019.2.0.

List all policy definitions for a subscription.

Parameters

hide_builtin -- Boolean which will filter out BuiltIn policy definitions from the result.

CLI Example:

salt-call azurearm_resource.policy_definitions_list
salt.modules.azurearm_resource.resource_group_check_existence(name, **kwargs)

New in version 2019.2.0.

Check for the existence of a named resource group in the current subscription.

Parameters

name -- The resource group name to check.

CLI Example:

salt-call azurearm_resource.resource_group_check_existence testgroup
salt.modules.azurearm_resource.resource_group_create_or_update(name, location, **kwargs)

New in version 2019.2.0.

Create or update a resource group in a given location.

Parameters
  • name -- The name of the resource group to create or update.

  • location -- The location of the resource group. This value is not able to be updated once the resource group is created.

CLI Example:

salt-call azurearm_resource.resource_group_create_or_update testgroup westus
salt.modules.azurearm_resource.resource_group_delete(name, **kwargs)

New in version 2019.2.0.

Delete a resource group from the subscription.

Parameters

name -- The resource group name to delete.

CLI Example:

salt-call azurearm_resource.resource_group_delete testgroup
salt.modules.azurearm_resource.resource_group_get(name, **kwargs)

New in version 2019.2.0.

Get a dictionary representing a resource group's properties.

Parameters

name -- The resource group name to get.

CLI Example:

salt-call azurearm_resource.resource_group_get testgroup
salt.modules.azurearm_resource.resource_groups_list(**kwargs)

New in version 2019.2.0.

List all resource groups within a subscription.

CLI Example:

salt-call azurearm_resource.resource_groups_list
salt.modules.azurearm_resource.subscription_get(subscription_id=None, **kwargs)

New in version 2019.2.0.

Get details about a subscription.

Parameters

subscription_id -- The ID of the subscription to query.

CLI Example:

salt-call azurearm_resource.subscription_get XXXXXXXX
salt.modules.azurearm_resource.subscriptions_list(**kwargs)

New in version 2019.2.0.

List all subscriptions for a tenant.

CLI Example:

salt-call azurearm_resource.subscriptions_list
salt.modules.azurearm_resource.subscriptions_list_locations(subscription_id=None, **kwargs)

New in version 2019.2.0.

List all locations for a subscription.

Parameters

subscription_id -- The ID of the subscription to query.

CLI Example:

salt-call azurearm_resource.subscriptions_list_locations XXXXXXXX
salt.modules.azurearm_resource.tenants_list(**kwargs)

New in version 2019.2.0.

List all tenants for your account.

CLI Example:

salt-call azurearm_resource.tenants_list