Add Network Security Group to Subnet
The Add Network Security Group to Subnet operation associates the network security group with specified subnet in a virtual network.
Request
The Add Network Security Group to Subnet request may be specified as follows. Replace <subscription-id> with the subscription ID and <virtual-network-name> with the name of the virtual network, and <subnet-name> with the name of subnet on which association will be added.
Method |
Request URI |
---|---|
POST |
https://management.core.windows.net/<subscription-id>/services/virtualnetwork/<virtual-network-name>/subnets/<subnet-name>/networksecuritygroups |
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
<NetworkSecurityGroup xmlns="https://schemas.microsoft.com/windowsazure">
<Name>network-security-group-name</Name>
</NetworkSecurityGroup>
The following table describes the elements in the request body.
Element name |
Description |
---|---|
Name |
Required. Specifies the name of the network security group that will be associated with the subnet. of gateway that is created. |
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.