exec.azurerm.network.network_security_group

Azure Resource Manager (ARM) Network Security Group Execution Module

New in version 1.0.0.

Changed in version 4.0.0.

maintainer:

<devops@eitr.tech>

configuration:

This module requires Azure Resource Manager credentials to be passed as keyword arguments to every function or via acct 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
idem_azurerm.exec.azurerm.network.network_security_group.create_or_update(hub, ctx, name, resource_group, **kwargs)

New in version 1.0.0.

Create or update a network security group.

Parameters:
  • name – The name of the network security group to create.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.create_or_update testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.default_security_rule_get(hub, ctx, name, security_group, resource_group, **kwargs)

New in version 1.0.0.

Get details about a default security rule within a security group.

Parameters:
  • name – The name of the security rule to query.
  • security_group – The network security group containing the security rule.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.default_security_rule_get "DenyAllOutBound" testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.default_security_rules_list(hub, ctx, security_group, resource_group, **kwargs)

New in version 1.0.0.

List default security rules within a security group.

Parameters:
  • security_group – The network security group to query.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.default_security_rules_list testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.delete(hub, ctx, name, resource_group, **kwargs)

New in version 1.0.0.

Delete a network security group within a resource group.

Parameters:
  • name – The name of the network security group to delete.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.delete testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.get(hub, ctx, name, resource_group, **kwargs)

New in version 1.0.0.

Get details about a network security group within a resource group.

Parameters:
  • name – The name of the network security group to query.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.get testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.list_(hub, ctx, resource_group=None, **kwargs)

New in version 1.0.0.

Changed in version 4.0.0.

List all network security groups within a subscription.

Parameters:resource_group – The name of the resource group to limit the results.

CLI Example:

azurerm.network.network_security_groups.list testgroup
idem_azurerm.exec.azurerm.network.network_security_group.security_rule_create_or_update(hub, ctx, name, access, direction, priority, protocol, security_group, resource_group, source_address_prefix=None, destination_address_prefix=None, source_port_range=None, destination_port_range=None, source_address_prefixes=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, **kwargs)

New in version 1.0.0.

Create or update a security rule within a specified network security group.

Parameters:
  • name – The name of the security rule to create.
  • access – ‘allow’ or ‘deny’
  • direction – ‘inbound’ or ‘outbound’
  • priority – Integer between 100 and 4096 used for ordering rule application.
  • protocol – ‘tcp’, ‘udp’, or ‘*’
  • destination_address_prefix – The CIDR or destination IP range. Asterix ‘*’ can also be used to match all destination IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. If this is an ingress rule, specifies where network traffic originates from.
  • destination_port_range – The destination port or range. Integer or range between 0 and 65535. Asterix ‘*’ can also be used to match all ports.
  • source_address_prefix – The CIDR or source IP range. Asterix ‘*’ can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. If this is an ingress rule, specifies where network traffic originates from.
  • source_port_range – The source port or range. Integer or range between 0 and 65535. Asterix ‘*’ can also be used to match all ports.
  • destination_address_prefixes – A list of destination_address_prefix values. This parameter overrides destination_address_prefix and will cause any value entered there to be ignored.
  • destination_port_ranges – A list of destination_port_range values. This parameter overrides destination_port_range and will cause any value entered there to be ignored.
  • source_address_prefixes – A list of source_address_prefix values. This parameter overrides source_address_prefix and will cause any value entered there to be ignored.
  • source_port_ranges – A list of source_port_range values. This parameter overrides source_port_range and will cause any value entered there to be ignored.
  • security_group – The network security group containing the security rule.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.security_rule_create_or_update testrule1 allow outbound 101 tcp
                                                                      testnsg testgroup
                                                                      source_address_prefix='*'
                                                                      destination_address_prefix=internet
                                                                      source_port_range='*'
                                                                      destination_port_range='1-1024'
idem_azurerm.exec.azurerm.network.network_security_group.security_rule_delete(hub, ctx, name, security_group, resource_group, **kwargs)

New in version 1.0.0.

Changed in version 4.0.0.

Delete a security rule within a specified security group.

Parameters:
  • name – The name of the security rule to delete.
  • security_group – The network security group containing the security rule.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.security_rule_delete testrule1 testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.security_rule_get(hub, ctx, name, security_group, resource_group, **kwargs)

New in version 1.0.0.

Changed in version 4.0.0.

Get a security rule within a specified network security group.

Parameters:
  • name – The name of the security rule to query.
  • security_group – The network security group containing the security rule.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.security_rule_get testrule1 testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.security_rules_list(hub, ctx, security_group, resource_group, **kwargs)

New in version 1.0.0.

List security rules within a network security group.

Parameters:
  • security_group – The network security group to query.
  • resource_group – The resource group name assigned to the network security group.

CLI Example:

azurerm.network.network_security_group.security_rules_list testnsg testgroup
idem_azurerm.exec.azurerm.network.network_security_group.update_tags(hub, ctx, name, resource_group, tags=None, **kwargs)

New in version 4.0.0.

Updates a network security group tags.

Parameters:
  • name – The name of the network security group.
  • resource_group – The name of the resource group.
  • tags – The tags of the resource.

CLI Example:

azurerm.network.network_security_group.update_tags test_name test_group tags='{"owner": "me"}'