ネットワーキングを構成する
Microsoft Azure仮想マシン、セキュリティグループ、インバウンドセキュリティルールを作成し、セキュリティルールを仮想マシンに関連付けます。
セキュリティグループを作成する
- Microsoft Azure Portalにサインインします。
- メニューからすべてのサービス(All Services)を選択してリソースグループ(Resource Groups)を検索します。または、お気に入りのリストからリソースグループ(Resource Groups)を選択します。
- ネットワークセキュリティルール一式を追加するリソースグループの名前をクリックします。
- 追加(Add)をクリックします。
- ネットワークセキュリティグループ(Network security group)を検索して選択します。
- 作成(Create)を選択します。
- セキュリティグループの名前を付けます。
- 作成・レビュー(Create and Review)をクリックします。
- 作成(Create)をクリックします。
受信セキュリティルールを作成する
- 設定(Settings)で、受信セキュリティルール(Inbound security rules)をクリックします。
- 追加(Add)をクリックします。
- 以下の値を入力します。
- 宛先ポートの範囲(Destination port range):
80/443 - プロトコル(Protocol):
TCP - 名前(Name):
Port80/Port443 Rule - 優先度(Priority):
100/101
注:ポート80は任意です。
- 宛先ポートの範囲(Destination port range):
- 追加(Add)をクリックします。
- これらの手順を繰り返し、ポート80および443のルールを作成します。
セキュリティルールを関連付ける
- に移動します。
- Access Gateway仮想マシンの名前をクリックします。
- 設定(Settings)で、サブネット(Subnets)を選択します。
- 関連付け(Associate)をクリックします。
- 以前作成したセキュリティグループを検索し、仮想マシンに関連付けます。
az network nsg createコマンドを使用して、ネットワークセキュリティを作成します。az network nsg create --resource-group AccessGateway --location <location> --name <name>-
<location>はセキュリティグループを格納する地域です。 -
<resource-group>は以前作成したリソースグループの名前です。 -
<name>は新しいセキュリティグループの名前です。
以下は、パラメーターに値を入力した
az network nsg createコマンドの例です。az network nsg create --resource-group AccessGateway --location eastus --name AGSecurityGroupaz network nsg createコマンドを実行すると、次の結果が表示されます。{ "NewNSG": { "defaultSecurityRules": [ { "destinationAddressPrefixes": [], "destinationApplicationSecurityGroups": null, . . . ]} }-
az network nsg rule createコマンドを使用してポート80のネットワークセキュリティルールを追加します。ポート80は任意です。az network nsg rule create \ --resource-group <resource-group>\ --nsg-name <network-security-group>\ --name <rule-name>\ --protocol tcp \ --priority 1000 \ --destination-port-range 80-
<resource-group>は以前に作成したリソースグループの名前です。 -
<nework-security-group>は新しいセキュリティグループの名前です。 -
<rule-name>はルールの名前です。
以下は、パラメーターに値を入力した
az network nsg rule createコマンドの例です。az network nsg rule create --resource-group AccessGateway \ --nsg-name AGSecurityGroup --name Port80GroupRule \ --protocol tcp --priority 1000 --destination-port-range 80az network nsg rule createコマンドを実行すると、次の結果が表示されます。{- Finished "access": "Allow", "description": null, "destinationAddressPrefix": "*", . . . }-
az network nsg rule createコマンドを使用してポート443のネットワークセキュリティルールを追加します。az network nsg rule create --resource-group AccessGateway --nsg-name AGSecurityGroup \ --name Port443GroupRule --protocol tcp --priority 1001 --destination-port-range 443az network nsg rule createコマンドを実行すると、次の結果が表示されます。{- Finished "access": "Allow", "description": null, "destinationAddressPrefix": "*", . . . }az network nic updateコマンドを使用して、新しいセキュリティグループをVM nicに関連付けます。az network nic update \ --resource-group <resource-group>\ --name <nic-name>\ --network-security-group <security-group-name>-
<resource-group>は以前作成したリソースグループの名前です。 -
<nic-name>はセキュリティグループと関連付けられるNICの名前です。 -
<nework-security-group>は新しいセキュリティグループの名前です。
以下は、パラメーターに値を入力した
az network nic updateコマンドの例です。# obtain the name of the nic. az vm nic list --resource-group AccessGateway --vm-name "OAG5.0vm" [{ "id": "/subscriptions/. . . /networkInterfaces/OAG5.0VMVMNic", . . . }] # Assign the security group to the nic az network nic update \ --resource-group AccessGateway\ --name OAG5.0VMMVNic --network-security-group AGSecurityGroupaz network nic updateコマンドを実行すると、次の結果が表示されます。{{"dnsSettings": { "dnsSettings": { appliedDnsServers": [], . . . }-