-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create-NIC-for-Web01.ps1
35 lines (28 loc) · 1.06 KB
/
Create-NIC-for-Web01.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#リソースグループ
$rg = "AW-RG"
#地域
$location = "japanwest"
# パブリックIPアドレス
$PublicIpAddressName = "Web01-IP"
$dnsNameforPublicIp = "mylab-we-ps"
$allocationMethod = "Dynamic"
# 仮想ネットワーク
$virtualNetworkName = "AW-VNet"
$subnetName = "Frontend-SN"
# NIC
$nicName = "Web01-NIC"
$privateIpAddress = "192.168.1.4"
# パブリック IP アドレスの作成
$pip = New-AzureRmPublicIpAddress `
-AllocationMethod $allocationMethod -ResourceGroupName $rg `
-DomainNameLabel $dnsNameforPublicIP `
-Location $location -Name $PublicIPAddressName
# NICを配置するサブネットの取得
$vnet = Get-AzureRmVirtualNetwork -Name $virtualNetworkName `
-ResourceGroupName $rg
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name $subnetName `
-VirtualNetwork $vnet
# NICの作成
$nic = New-AzureRmNetworkInterface -ResourceGroupName $rg `
-Location $location -Name $nicName -Subnet $subnet `
-PrivateIpAddress $privateIpAddress -PublicIpAddress $pip