Skip to main content

security_rules

Creates, updates, deletes, gets or lists a security_rules resource.

Overview

Namesecurity_rules
TypeResource
Idazure.network.security_rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringResource ID.
namestringName of the resource.
accessstringThe network traffic is allowed or denied. Required. Known values are: "Allow" and "Deny". (Allow, Deny)
descriptionstringA description for this rule. Restricted to 140 chars.
destinationAddressPrefixstringThe 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.
destinationAddressPrefixesarrayThe destination address prefixes. CIDR or destination IP ranges.
destinationApplicationSecurityGroupsarrayThe application security group specified as destination.
destinationPortRangestringThe destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
destinationPortRangesarrayThe destination port ranges.
directionstringThe 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)
etagstringA unique read-only string that changes whenever the resource is updated.
priorityintegerThe 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.
protocolstringNetwork protocol this rule applies to. Required. Known values are: "Tcp", "Udp", "Icmp", "Esp", "*", and "Ah". (Tcp, Udp, Icmp, Esp, *, Ah)
provisioningStatestringThe provisioning state of the security rule resource. Known values are: "Failed", "Succeeded", "Canceled", "Creating", "Updating", and "Deleting". (Failed, Succeeded, Canceled, Creating, Updating, Deleting)
sourceAddressPrefixstringThe 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.
sourceAddressPrefixesarrayThe CIDR or source IP ranges.
sourceApplicationSecurityGroupsarrayThe application security group specified as source.
sourcePortRangestringThe source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
sourcePortRangesarrayThe source port ranges.
typestringResource type.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, network_security_group_name, security_rule_name, subscription_idGet the specified network security rule.
listselectresource_group_name, network_security_group_name, subscription_idGets all security rules in a network security group.
create_or_updateinsertresource_group_name, network_security_group_name, security_rule_name, subscription_idCreates or updates a security rule in the specified network security group.
create_or_updatereplaceresource_group_name, network_security_group_name, security_rule_name, subscription_idCreates or updates a security rule in the specified network security group.
deletedeleteresource_group_name, network_security_group_name, security_rule_name, subscription_idDeletes 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.

NameDatatypeDescription
network_security_group_namestringThe name of the network security group. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
security_rule_namestringThe name of the security rule. Required.
subscription_idstring

SELECT examples

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
;

INSERT examples

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
;

REPLACE examples

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

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
;