security_rules#
State module for managing network Security Rules.
- async idem_azure.states.azure.network.security_rules.present(hub, ctx, name: str, resource_group_name: str, network_security_group_name: str, security_rule_name: str, priority: int, direction: str, access: str, protocol: str, description: str = None, source_port_range: str = None, source_port_ranges: List[str] = None, source_address_prefix: str = None, source_address_prefixes: List[str] = None, source_application_security_groups: List[str] = None, destination_port_range: str = None, destination_port_ranges: List[str] = None, destination_address_prefix: str = None, destination_address_prefixes: List[str] = None, destination_application_security_groups: List[str] = None, subscription_id: str = None, resource_id: str = None) Dict[str, Any] [source]#
Create or update Security Rules.
- Parameters:
name (str) – The identifier for this state.
resource_group_name (str) – The name of the resource group.
network_security_group_name (str) – The name of the network security group.
security_rule_name (str) – The name of the security rule.
priority (int) – The priority of the security rule. The value can be between 100 and 4096.The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.
direction (str) – The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
access (str) – The network traffic is allowed or denied.
protocol (str) – Network protocol this rule applies to.
description (str, Optional) – A description for this rule.
source_port_range (str, Optional) – The source port or range. Integer or range between 0 and 65535. Asterisk ‘*’ can also be used to match all ports.
source_port_ranges (list[str], Optional) – The source port ranges. Either this or source_port_range need to be provided.
source_address_prefix (str, Optional) – The source address prefix. CIDR or source IP range. Asterisk ‘*’ 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_address_prefixes (list[str], Optional) – The CIDR or source IP ranges.
source_application_security_groups (list[str], Optional) – The list of resource id of the application security group. Either one of source_address_prefix, source_address_prefixes or source_application_security_groups needs to be provided.
destination_port_range (str, Optional) – The destination port or range. Integer or range between 0 and 65535. Asterisk ‘*’ can also be used to match all ports.
destination_port_ranges (list[str], Optional) – The destination port ranges. Either this or destination_port_range need to be provided.
destination_address_prefix (str, Optional) – The destination address prefix. CIDR or destination IP range. Asterisk ‘*’ can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used.
destination_address_prefixes (list[str], Optional) – The destination address prefixes. CIDR or destination IP ranges.
destination_application_security_groups (list[str], Optional) – The list of resource id of the application security group. Either one of destination_address_prefix, destination_address_prefixes or destination_application_security_groups needs to be provided.
subscription_id (str, Optional) – Subscription Unique id.
resource_id (str, Optional) – Security rule resource id.
- Returns:
Dict[str, Any]
Examples
resource_is_present: azure.network.security_rules.present: - name: rule1 - resource_id: /subscriptions/12345678-1234-1234-1234-aaabc1234aaa/resourceGroups/rg-1/providers/Microsoft.Network/networkSecurityGroups/nsg-1/securityRules/rule1 - resource_group_name: rg-1 - subscription_id: 12345678-1234-1234-1234-aaabc1234aaa - network_security_group_name: nsg-1 - security_rule_name: rule1 - protocol: '*' - source_address_prefix: '*' - destination_port_range: '80' - destination_address_prefix: '*' - access: Allow - priority: 130 - direction: Inbound - source_port_ranges: - '20' - '50' - '80'
- async idem_azure.states.azure.network.security_rules.absent(hub, ctx, name: str, resource_group_name: str, network_security_group_name: str, security_rule_name: str, subscription_id: str = None) Dict[str, Any] [source]#
Delete Security Rule.
- Parameters:
- Returns:
Dict[str, Any]
Examples
resource_is_absent: azure.network.security_rules.absent: - name: value - resource_group_name: value - network_security_group_name: value - security_rule_name: value
- async idem_azure.states.azure.network.security_rules.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 Security Rules under the same subscription.
- Returns:
Dict[str, Any]
Examples
$ idem describe azure.network.security_rules