Get Network Security Group

 

The Get Network Security Group operation returns information about the specified network security group.

Request

The Get Network Security Group request may be specified as follows. Replace <subscription-id> with the subscription ID and <network-security-group-name> with the name of the network security group that you want to get information about.

Method

Request URI

GET

https://management.core.windows.net/<subscription-id>/services/networking/networksecuritygroups/<network-security-group-name>

URI Parameters

URI Parameter

Description

detaillevel=Full

Optional. Specifies that the rules for the network security group should be returned.

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

None.

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 200 (OK).

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

The format of the response body is as follows:

<NetworkSecurityGroup xmlns="https://schemas.microsoft.com/windowsazure"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Name>network-security-group-name</Name>
  <Label>label-of-network-security-group</Label>
  <Location>location-of-network-security-group</Location>
  <State>network-security-group-state</State>
  <Rules>
    <Rule>
      <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>
      <State>state-of-the-rule</State>
      <IsDefault>is-this-default-rule</IsDefault>
    </Rule>
  </Rules>
</NetworkSecurityGroup>

The following table describes the elements in the response body.

Element name

Description

Name

Specifies the name of the security group.

Label

Specifies an identifier for the network security group.

Location

Specifies the location of the network security group.

State

Specifies the state of the network security group.

Possible values are:

  • Created

  • Creating

  • Updating

  • Deleting

  • Unavailable

Rules

Specifies a collection of network security group rules. This element is included only if the detaillevel URI parameter is set to Full.

Rules

Specifies a collection of network security group rules. Each Rule element contains the child elements listed in the following table.

Element name

Description

Name

Specifies the name of the network security rule.

Type

Specifies the type of the network security rule.

Possible values are:

  • Inbound

  • Outbound

Priority

Specifies the priority of the network security rule. Rules with lower priority are evaluated first.

Action

Specifies the action that is performed when the network security rule is matched.

Possible values are:

  • Allow

  • Deny

SourceAddressPrefix

Specifies the CIDR or source IP range.

SourcePortRange

Specifies the source port or range.

DestinationAddressPrefix

Specifies the CIDR or destination IP range.

DestinationPortRange

Specifies the destination port or range.

Protocol

Specifies the protocol of the network security rule.

State

Specifies the state of the network security rule.

Possible values are:

  • Created

  • Creating

  • Updating

  • Deleting

  • Unavailable

IsDefault

Specifies if this is default system rule. If the value is False or missing, it is a user-defined rule.