security_rules
Creates, updates, deletes, gets or lists a security_rules resource.
Overview
| Name | security_rules |
| Type | Resource |
| Id | azure.network.security_rules |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Resource ID. |
name | string | Name of the resource. |
access | string | The network traffic is allowed or denied. Required. Known values are: "Allow" and "Deny". (Allow, Deny) |
description | string | A description for this rule. Restricted to 140 chars. |
destinationAddressPrefix | string | 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. |
destinationAddressPrefixes | array | The destination address prefixes. CIDR or destination IP ranges. |
destinationApplicationSecurityGroups | array | The application security group specified as destination. |
destinationPortRange | string | The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. |
destinationPortRanges | array | The destination port ranges. |
direction | string | The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Required. Known values are: "Inbound" and "Outbound". (Inbound, Outbound) |
etag | string | A unique read-only string that changes whenever the resource is updated. |
priority | integer | The priority of the 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. Required. |
protocol | string | Network protocol this rule applies to. Required. Known values are: "Tcp", "Udp", "Icmp", "Esp", "*", and "Ah". (Tcp, Udp, Icmp, Esp, *, Ah) |
provisioningState | string | The provisioning state of the security rule resource. Known values are: "Failed", "Succeeded", "Canceled", "Creating", "Updating", and "Deleting". (Failed, Succeeded, Canceled, Creating, Updating, Deleting) |
sourceAddressPrefix | string | The 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. |
sourceAddressPrefixes | array | The CIDR or source IP ranges. |
sourceApplicationSecurityGroups | array | The application security group specified as source. |
sourcePortRange | string | The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. |
sourcePortRanges | array | The source port ranges. |
type | string | Resource type. |
| Name | Datatype | Description |
|---|---|---|
id | string | Resource ID. |
name | string | Name of the resource. |
access | string | The network traffic is allowed or denied. Required. Known values are: "Allow" and "Deny". (Allow, Deny) |
description | string | A description for this rule. Restricted to 140 chars. |
destinationAddressPrefix | string | 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. |
destinationAddressPrefixes | array | The destination address prefixes. CIDR or destination IP ranges. |
destinationApplicationSecurityGroups | array | The application security group specified as destination. |
destinationPortRange | string | The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. |
destinationPortRanges | array | The destination port ranges. |
direction | string | The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Required. Known values are: "Inbound" and "Outbound". (Inbound, Outbound) |
etag | string | A unique read-only string that changes whenever the resource is updated. |
priority | integer | The priority of the 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. Required. |
protocol | string | Network protocol this rule applies to. Required. Known values are: "Tcp", "Udp", "Icmp", "Esp", "*", and "Ah". (Tcp, Udp, Icmp, Esp, *, Ah) |
provisioningState | string | The provisioning state of the security rule resource. Known values are: "Failed", "Succeeded", "Canceled", "Creating", "Updating", and "Deleting". (Failed, Succeeded, Canceled, Creating, Updating, Deleting) |
sourceAddressPrefix | string | The 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. |
sourceAddressPrefixes | array | The CIDR or source IP ranges. |
sourceApplicationSecurityGroups | array | The application security group specified as source. |
sourcePortRange | string | The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. |
sourcePortRanges | array | The source port ranges. |
type | string | Resource type. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, network_security_group_name, security_rule_name, subscription_id | Get the specified network security rule. | |
list | select | resource_group_name, network_security_group_name, subscription_id | Gets all security rules in a network security group. | |
create_or_update | insert | resource_group_name, network_security_group_name, security_rule_name, subscription_id | Creates or updates a security rule in the specified network security group. | |
create_or_update | replace | resource_group_name, network_security_group_name, security_rule_name, subscription_id | Creates or updates a security rule in the specified network security group. | |
delete | delete | resource_group_name, network_security_group_name, security_rule_name, subscription_id | Deletes the specified network security rule. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
network_security_group_name | string | The name of the network security group. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
security_rule_name | string | The name of the security rule. Required. |
subscription_id | string |
SELECT examples
- get
- list
Get the specified network security rule.
SELECT
id,
name,
access,
description,
destinationAddressPrefix,
destinationAddressPrefixes,
destinationApplicationSecurityGroups,
destinationPortRange,
destinationPortRanges,
direction,
etag,
priority,
protocol,
provisioningState,
sourceAddressPrefix,
sourceAddressPrefixes,
sourceApplicationSecurityGroups,
sourcePortRange,
sourcePortRanges,
type
FROM azure.network.security_rules
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND network_security_group_name = '{{ network_security_group_name }}' -- required
AND security_rule_name = '{{ security_rule_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Gets all security rules in a network security group.
SELECT
id,
name,
access,
description,
destinationAddressPrefix,
destinationAddressPrefixes,
destinationApplicationSecurityGroups,
destinationPortRange,
destinationPortRanges,
direction,
etag,
priority,
protocol,
provisioningState,
sourceAddressPrefix,
sourceAddressPrefixes,
sourceApplicationSecurityGroups,
sourcePortRange,
sourcePortRanges,
type
FROM azure.network.security_rules
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND network_security_group_name = '{{ network_security_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
Creates or updates a security rule in the specified network security group.
INSERT INTO azure.network.security_rules (
id,
name,
properties,
resource_group_name,
network_security_group_name,
security_rule_name,
subscription_id
)
SELECT
'{{ id }}',
'{{ name }}',
'{{ properties }}',
'{{ resource_group_name }}',
'{{ network_security_group_name }}',
'{{ security_rule_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
properties,
type
;
# Description fields are for documentation purposes
- name: security_rules
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the security_rules resource.
- name: network_security_group_name
value: "{{ network_security_group_name }}"
description: Required parameter for the security_rules resource.
- name: security_rule_name
value: "{{ security_rule_name }}"
description: Required parameter for the security_rules resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the security_rules resource.
- name: id
value: "{{ id }}"
description: |
Resource ID.
- name: name
value: "{{ name }}"
description: |
Name of the resource.
- name: properties
description: |
Properties of the security rule.
value:
description: "{{ description }}"
protocol: "{{ protocol }}"
sourcePortRange: "{{ sourcePortRange }}"
destinationPortRange: "{{ destinationPortRange }}"
sourceAddressPrefix: "{{ sourceAddressPrefix }}"
sourceAddressPrefixes:
- "{{ sourceAddressPrefixes }}"
sourceApplicationSecurityGroups:
- id: "{{ id }}"
name: "{{ name }}"
type: "{{ type }}"
location: "{{ location }}"
tags: "{{ tags }}"
properties:
resourceGuid: "{{ resourceGuid }}"
provisioningState: "{{ provisioningState }}"
etag: "{{ etag }}"
destinationAddressPrefix: "{{ destinationAddressPrefix }}"
destinationAddressPrefixes:
- "{{ destinationAddressPrefixes }}"
destinationApplicationSecurityGroups:
- id: "{{ id }}"
name: "{{ name }}"
type: "{{ type }}"
location: "{{ location }}"
tags: "{{ tags }}"
properties:
resourceGuid: "{{ resourceGuid }}"
provisioningState: "{{ provisioningState }}"
etag: "{{ etag }}"
sourcePortRanges:
- "{{ sourcePortRanges }}"
destinationPortRanges:
- "{{ destinationPortRanges }}"
access: "{{ access }}"
priority: {{ priority }}
direction: "{{ direction }}"
provisioningState: "{{ provisioningState }}"
REPLACE examples
- create_or_update
Creates or updates a security rule in the specified network security group.
REPLACE azure.network.security_rules
SET
id = '{{ id }}',
name = '{{ name }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND network_security_group_name = '{{ network_security_group_name }}' --required
AND security_rule_name = '{{ security_rule_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
properties,
type;
DELETE examples
- delete
Deletes the specified network security rule.
DELETE FROM azure.network.security_rules
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND network_security_group_name = '{{ network_security_group_name }}' --required
AND security_rule_name = '{{ security_rule_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;