Security Rules - Get
Get the specified network security rule.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}?api-version=2025-05-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
network
|
path | True |
string |
The name of the network security group. |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
The name of the resource group. The name is case insensitive. |
|
security
|
path | True |
string |
The name of the security rule. |
|
subscription
|
path | True |
string (uuid) |
The ID of the target subscription. The value must be an UUID. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Azure operation completed successfully. |
|
| Other Status Codes |
An unexpected error response. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name | Description |
|---|---|
| user_impersonation | impersonate your user account |
Examples
Get network security rule in network security group
Sample request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1?api-version=2025-05-01
Sample response
{
"name": "rule1",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1",
"properties": {
"access": "Allow",
"destinationAddressPrefix": "*",
"destinationPortRange": "80",
"direction": "Inbound",
"priority": 130,
"provisioningState": "Succeeded",
"sourceAddressPrefix": "*",
"sourcePortRange": "*",
"protocol": "*"
}
}
Definitions
| Name | Description |
|---|---|
|
Common. |
An application security group in a resource group. |
|
Common. |
An error response from the service. |
|
Common. |
An error response from the service. |
|
Common. |
Network security rule. |
|
Provisioning |
The provisioning state of the application security group resource. |
|
Security |
The network traffic is allowed or denied. |
|
Security |
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. |
|
Security |
Network protocol this rule applies to. |
Common.ApplicationSecurityGroup
An application security group in a resource group.
| Name | Type | Description |
|---|---|---|
| etag |
string |
A unique read-only string that changes whenever the resource is updated. |
| id |
string |
Resource ID. |
| location |
string |
Resource location. |
| name |
string |
Resource name. |
| properties.provisioningState |
The provisioning state of the application security group resource. |
|
| properties.resourceGuid |
string |
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. |
| tags |
object |
Resource tags. |
| type |
string |
Resource type. |
Common.CloudError
An error response from the service.
| Name | Type | Description |
|---|---|---|
| error |
Cloud error body. |
Common.CloudErrorBody
An error response from the service.
| Name | Type | Description |
|---|---|---|
| code |
string |
An identifier for the error. Codes are invariant and are intended to be consumed programmatically. |
| details |
A list of additional details about the error. |
|
| message |
string |
A message describing the error, intended to be suitable for display in a user interface. |
| target |
string |
The target of the particular error. For example, the name of the property in error. |
Common.SecurityRule
Network security rule.
| Name | Type | Description |
|---|---|---|
| etag |
string |
A unique read-only string that changes whenever the resource is updated. |
| id |
string |
Resource ID. |
| name |
string |
Name of the resource. |
| properties.access |
The network traffic is allowed or denied. |
|
| properties.description |
string |
A description for this rule. Restricted to 140 chars. |
| properties.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. |
| properties.destinationAddressPrefixes |
string[] |
The destination address prefixes. CIDR or destination IP ranges. |
| properties.destinationApplicationSecurityGroups |
The application security group specified as destination. |
|
| properties.destinationPortRange |
string |
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. |
| properties.destinationPortRanges |
string[] |
The destination port ranges. |
| properties.direction |
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. |
|
| properties.priority |
integer (int32) |
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. |
| properties.protocol |
Network protocol this rule applies to. |
|
| properties.provisioningState |
The provisioning state of the security rule resource. |
|
| properties.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. |
| properties.sourceAddressPrefixes |
string[] |
The CIDR or source IP ranges. |
| properties.sourceApplicationSecurityGroups |
The application security group specified as source. |
|
| properties.sourcePortRange |
string |
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. |
| properties.sourcePortRanges |
string[] |
The source port ranges. |
| type |
string |
Resource type. |
ProvisioningState
The provisioning state of the application security group resource.
| Value | Description |
|---|---|
| Failed |
Failed |
| Succeeded |
Succeeded |
| Canceled |
Canceled |
| Creating |
Creating |
| Updating |
Updating |
| Deleting |
Deleting |
SecurityRuleAccess
The network traffic is allowed or denied.
| Value | Description |
|---|---|
| Allow |
Allow |
| Deny |
Deny |
SecurityRuleDirection
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
| Value | Description |
|---|---|
| Inbound |
Inbound |
| Outbound |
Outbound |
SecurityRuleProtocol
Network protocol this rule applies to.
| Value | Description |
|---|---|
| Tcp |
Tcp |
| Udp |
Udp |
| Icmp |
Icmp |
| Esp |
Esp |
| * |
|
| Ah |
Ah |