Security Rules - Create Or Update

指定したネットワーク セキュリティ グループのセキュリティ規則を作成または更新します。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}?api-version=2023-09-01

URI パラメーター

名前 / 必須 説明
networkSecurityGroupName
path True

string

ネットワーク セキュリティ グループの名前。

resourceGroupName
path True

string

リソース グループの名前。

securityRuleName
path True

string

セキュリティ規則の名前。

subscriptionId
path True

string

Microsoft Azure サブスクリプションを一意に識別するサブスクリプションの資格情報。 サブスクリプション ID は、全ての修理依頼についてURI の一部を生じさせます。

api-version
query True

string

クライアント API バージョン。

要求本文

名前 必須 説明
properties.access True

SecurityRuleAccess

ネットワーク トラフィックは許可または拒否されます。

properties.direction True

SecurityRuleDirection

ルールの方向。 この方向は、ルールの評価が受信または送信トラフィックのどちらで行われるかを指定します。

properties.priority True

integer

ルールの優先度。 値は 100 から 4096 の間で指定できます。 優先度番号は、コレクション内のルールごとに一意である必要があります。 優先度番号が低いほど、規則の優先度が高くなります。

properties.protocol True

SecurityRuleProtocol

この規則が適用されるネットワーク プロトコル。

id

string

リソースの ID

name

string

リソース グループ内で一意のリソースの名前。 この名前は、リソースへのアクセスに使用できます。

properties.description

string

この規則の説明。 140 文字に制限されています。

properties.destinationAddressPrefix

string

宛先アドレス プレフィックス。 CIDR または宛先 IP 範囲。 また、すべてのソース IP に一致させるためにアスタリスク '*' を使用することもできます。 "VirtualNetwork"、"AzureLoadBalancer"、"Internet" などの既定のタグも使用できます。

properties.destinationAddressPrefixes

string[]

宛先アドレス プレフィックス。 CIDR または宛先 IP 範囲。

properties.destinationApplicationSecurityGroups

ApplicationSecurityGroup[]

宛先として指定されたアプリケーション セキュリティ グループ。

properties.destinationPortRange

string

宛先ポートまたは範囲。 整数または 0 ~ 65535 の範囲。 アスタリスク '*' を使用して、すべてのポートを照合することもできます。

properties.destinationPortRanges

string[]

宛先ポート範囲。

properties.sourceAddressPrefix

string

CIDR またはソース IP 範囲。 また、すべてのソース IP に一致させるためにアスタリスク '*' を使用することもできます。 "VirtualNetwork"、"AzureLoadBalancer"、"Internet" などの既定のタグも使用できます。 これがイングレス ルールの場合は、ネットワーク トラフィックの発信元を指定します。

properties.sourceAddressPrefixes

string[]

CIDR またはソース IP 範囲。

properties.sourceApplicationSecurityGroups

ApplicationSecurityGroup[]

ソースとして指定されたアプリケーション セキュリティ グループ。

properties.sourcePortRange

string

ソース ポートまたは範囲。 整数または 0 ~ 65535 の範囲。 アスタリスク '*' を使用して、すべてのポートを照合することもできます。

properties.sourcePortRanges

string[]

ソース ポートの範囲。

type

string

リソースの型。

応答

名前 説明
200 OK

SecurityRule

更新が成功しました。 この操作は、結果として得られる SecurityRule リソースを返します。

201 Created

SecurityRule

正常に作成されます。 この操作は、結果として得られる SecurityRule リソースを返します。

Other Status Codes

CloudError

操作に失敗した理由を説明するエラー応答。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名前 説明
user_impersonation ユーザー アカウントの借用

Create security rule

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1?api-version=2023-09-01

{
  "properties": {
    "protocol": "*",
    "sourceAddressPrefix": "10.0.0.0/8",
    "destinationAddressPrefix": "11.0.0.0/8",
    "access": "Deny",
    "destinationPortRange": "8080",
    "sourcePortRange": "*",
    "priority": 100,
    "direction": "Outbound"
  }
}

Sample Response

{
  "name": "rule1",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1",
  "properties": {
    "provisioningState": "Succeeded",
    "protocol": "*",
    "sourcePortRange": "*",
    "destinationPortRange": "8080",
    "sourceAddressPrefix": "10.0.0.0/8",
    "destinationAddressPrefix": "11.0.0.0/8",
    "access": "Deny",
    "priority": 100,
    "direction": "Outbound"
  }
}
{
  "name": "rule1",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1",
  "properties": {
    "provisioningState": "Succeeded",
    "protocol": "*",
    "sourcePortRange": "*",
    "destinationPortRange": "8080",
    "sourceAddressPrefix": "10.0.0.0/8",
    "destinationAddressPrefix": "11.0.0.0/8",
    "access": "Deny",
    "priority": 100,
    "direction": "Outbound"
  }
}

定義

名前 説明
ApplicationSecurityGroup

リソース グループ内のアプリケーション セキュリティ グループ。

CloudError

サービスからのエラー応答。

CloudErrorBody

サービスからのエラー応答。

ProvisioningState

現在のプロビジョニング状態。

SecurityRule

ネットワーク セキュリティ規則。

SecurityRuleAccess

ネットワーク トラフィックが許可されるか拒否されるか。

SecurityRuleDirection

ルールの方向。 この方向は、ルールの評価が受信または送信トラフィックのどちらで行われるかを指定します。

SecurityRuleProtocol

この規則が適用されるネットワーク プロトコル。

ApplicationSecurityGroup

リソース グループ内のアプリケーション セキュリティ グループ。

名前 説明
etag

string

リソースが更新されるたびに変更される一意の読み取り専用文字列。

id

string

リソースの ID

location

string

リソースの場所。

name

string

リソース名。

properties.provisioningState

ProvisioningState

アプリケーション セキュリティ グループ リソースのプロビジョニング状態。

properties.resourceGuid

string

アプリケーション セキュリティ グループ リソースのリソース GUID プロパティ。 ユーザーが名前を変更したり、サブスクリプションまたはリソース グループ間でリソースを移行したりした場合でも、リソースを一意に識別します。

tags

object

リソース タグ。

type

string

リソースの種類。

CloudError

サービスからのエラー応答。

名前 説明
error

CloudErrorBody

クラウド エラー本文。

CloudErrorBody

サービスからのエラー応答。

名前 説明
code

string

エラーの識別子。 コードは不変であり、プログラムによって使用されることを意図しています。

details

CloudErrorBody[]

エラーに関するその他の詳細の一覧。

message

string

ユーザー インターフェイスでの表示に適したエラーを説明するメッセージ。

target

string

特定のエラーのターゲット。 たとえば、エラーが発生したプロパティの名前です。

ProvisioningState

現在のプロビジョニング状態。

名前 説明
Deleting

string

Failed

string

Succeeded

string

Updating

string

SecurityRule

ネットワーク セキュリティ規則。

名前 説明
etag

string

リソースが更新されるたびに変更される一意の読み取り専用文字列。

id

string

リソースの ID

name

string

リソース グループ内で一意のリソースの名前。 この名前は、リソースへのアクセスに使用できます。

properties.access

SecurityRuleAccess

ネットワーク トラフィックは許可または拒否されます。

properties.description

string

この規則の説明。 140 文字に制限されています。

properties.destinationAddressPrefix

string

宛先アドレス プレフィックス。 CIDR または宛先 IP 範囲。 また、すべてのソース IP に一致させるためにアスタリスク '*' を使用することもできます。 "VirtualNetwork"、"AzureLoadBalancer"、"Internet" などの既定のタグも使用できます。

properties.destinationAddressPrefixes

string[]

宛先アドレス プレフィックス。 CIDR または宛先 IP 範囲。

properties.destinationApplicationSecurityGroups

ApplicationSecurityGroup[]

宛先として指定されたアプリケーション セキュリティ グループ。

properties.destinationPortRange

string

宛先ポートまたは範囲。 整数または 0 ~ 65535 の範囲。 アスタリスク '*' を使用して、すべてのポートを照合することもできます。

properties.destinationPortRanges

string[]

宛先ポート範囲。

properties.direction

SecurityRuleDirection

ルールの方向。 この方向は、ルールの評価が受信または送信トラフィックのどちらで行われるかを指定します。

properties.priority

integer

ルールの優先度。 値は 100 から 4096 の間で指定できます。 優先度番号は、コレクション内のルールごとに一意である必要があります。 優先度番号が低いほど、規則の優先度が高くなります。

properties.protocol

SecurityRuleProtocol

この規則が適用されるネットワーク プロトコル。

properties.provisioningState

ProvisioningState

セキュリティ 規則リソースのプロビジョニング状態。

properties.sourceAddressPrefix

string

CIDR またはソース IP 範囲。 また、すべてのソース IP に一致させるためにアスタリスク '*' を使用することもできます。 "VirtualNetwork"、"AzureLoadBalancer"、"Internet" などの既定のタグも使用できます。 これがイングレス ルールの場合は、ネットワーク トラフィックの発信元を指定します。

properties.sourceAddressPrefixes

string[]

CIDR またはソース IP 範囲。

properties.sourceApplicationSecurityGroups

ApplicationSecurityGroup[]

ソースとして指定されたアプリケーション セキュリティ グループ。

properties.sourcePortRange

string

ソース ポートまたは範囲。 整数または 0 ~ 65535 の範囲。 アスタリスク '*' を使用して、すべてのポートを照合することもできます。

properties.sourcePortRanges

string[]

ソース ポートの範囲。

type

string

リソースの型。

SecurityRuleAccess

ネットワーク トラフィックが許可されるか拒否されるか。

名前 説明
Allow

string

Deny

string

SecurityRuleDirection

ルールの方向。 この方向は、ルールの評価が受信または送信トラフィックのどちらで行われるかを指定します。

名前 説明
Inbound

string

Outbound

string

SecurityRuleProtocol

この規則が適用されるネットワーク プロトコル。

名前 説明
*

string

Ah

string

Esp

string

Icmp

string

Tcp

string

Udp

string