Set Network Security Rule
The Set Network Security Rule operation adds or updates a network security rule that is associated with the specified network security group.
Request
The Set Network Security Rule request may be specified as follows. Replace <subscription-id> with the subscription ID, <network-security-group-name> with the name of the network security group, and <rule-name> with the name of the network security rule.
Method |
Request URI |
---|---|
PUT |
https://management.core.windows.net/<subscription-id>/services/networking/networksecuritygroups/<network-security-group-name>/rules/<rule-name> |
URI Parameters
None.
Request Headers
The following table describes the request headers.
Request Header |
Description |
---|---|
Content-Type |
Required. Specifies that the the type of the request content. The value should be set to application/xml. |
x-ms-version |
Required. Specifies the version of the operation to use for this request. The value for this header should be set to 2014-10-01 or higher. |
Request Body
The format of the request body is as follows:
<Rule xmlns="https://schemas.microsoft.com/windowsazure">
<Name>rule-name</Name>
<Type>type-of-the-rule</Type>
<Priority>rule-priority</Priority>
<Action>rule-action</Action>
<SourceAddressPrefix>rule-source-address</SourceAddressPrefix>
<SourcePortRange>rule-source-port</SourcePortRange>
<DestinationAddressPrefix>rule-destination-address</DestinationAddressPrefix>
<DestinationPortRange>rule-destination-port</DestinationPortRange>
<Protocol>rule-protocol</Protocol>
</Rule>
The following table describes the elements in the request body.
Element name |
Description |
---|---|
Name |
Specifies the name of the network security rule. |
Type |
Specifies the type of the network security rule. Possible values are:
|
Priority |
Specifies the priority of the network security rule. Rules with lower priority are evaluated first. This value can be between 100 and 4096. |
Action |
Specifies the action that is performed when the network security rule is matched. Possible values are:
|
SourceAddressPrefix |
Specifies the CIDR or source IP range. An asterisk (*) can also be used to match all source IPs. |
SourcePortRange |
Specifies the source port or range. This value can be between 0 and 65535. An asterisk (*) can also be used to match all ports. |
DestinationAddressPrefix |
Specifies the CIDR or destination IP range. An asterisk (*) can also be used to match all destination IPs. |
DestinationPortRange |
Specifies the destination port or range. This value can be between 0 and 65535. An asterisk (*) can also be used to match all ports. |
Protocol |
Specifies the protocol of the network security rule. Possible values are:
|
Response
The response includes an HTTP status code, a response body, and a set of response headers.
Status Code
A successful operation returns status code 202 (Accepted).
Response Headers
The response for this operation includes the following headers. The response may also include additional standard HTTP headers.
Response Header |
Description |
---|---|
x-ms-request-id |
A value that uniquely identifies a request made against the management service. |
Response Body
None.