Skip to main content

security_rules

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

Overview

Namesecurity_rules
TypeResource
Idazure_stack.azure_stack_hci_vm.security_rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name 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.
destinationAddressPrefixesarrayThe destination address prefixes. CIDR or destination IP ranges.
destinationPortRangesarrayThe destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
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)
extendedLocationobjectThe extendedLocation of the resource.
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", and "*". (Tcp, Udp, Icmp, *)
provisioningStatestringProvisioning state of the SR. Known values are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". (Succeeded, Failed, InProgress, Accepted, Deleting, Canceled)
sourceAddressPrefixesarrayThe CIDR or source IP ranges.
sourcePortRangesarrayThe source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, network_security_group_name, security_rule_name, subscription_idGets the specified security rule.
list_by_network_security_groupselectresource_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 resource group.
create_or_updatereplaceresource_group_name, network_security_group_name, security_rule_name, subscription_idCreates or updates a security rule in the specified resource group.
deletedeleteresource_group_name, network_security_group_name, security_rule_name, subscription_idDeletes the specified 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_namestringName of the network security group. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
security_rule_namestringName of the security rule. Required.
subscription_idstring

SELECT examples

Gets the specified security rule.

SELECT
id,
name,
access,
description,
destinationAddressPrefixes,
destinationPortRanges,
direction,
extendedLocation,
priority,
protocol,
provisioningState,
sourceAddressPrefixes,
sourcePortRanges,
systemData,
type
FROM azure_stack.azure_stack_hci_vm.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 resource group.

INSERT INTO azure_stack.azure_stack_hci_vm.security_rules (
properties,
extendedLocation,
resource_group_name,
network_security_group_name,
security_rule_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ extendedLocation }}',
'{{ resource_group_name }}',
'{{ network_security_group_name }}',
'{{ security_rule_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
extendedLocation,
properties,
systemData,
type
;

REPLACE examples

Creates or updates a security rule in the specified resource group.

REPLACE azure_stack.azure_stack_hci_vm.security_rules
SET
properties = '{{ properties }}',
extendedLocation = '{{ extendedLocation }}'
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,
extendedLocation,
properties,
systemData,
type;

DELETE examples

Deletes the specified security rule.

DELETE FROM azure_stack.azure_stack_hci_vm.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
;