Azure Power Shell
Azure Power Shell
Azure Power Shell
$vnet1 = New-AzVirtualNetwork
-Name "vnet-1"
-ResourceGroupName "TEST3"
-Location "japanEast"
-AddressPrefix "172.16.0.0/16"
-Name "subnet-1"
-AddressPrefix "172.16.1.0/24"
-Name "vnet-2"
-ResourceGroupName "TEST3"
-Location "japanEast"
-AddressPrefix "192.168.0.0/16"
-Name "subnet-2"
-AddressPrefix "192.168.1.0/24"
-Name "public-ip1"
-ResourceGroupName "TEST3"
-Location "japanEast"
-AllocationMethod "Static"
-Sku "Standard"
-Tier "Regional"
-Name "public-ip2"
-ResourceGroupName "TEST3"
-Location "japanEast"
-AllocationMethod "Static"
-Sku "Standard"
-Tier "Regional"
# Créer le NSG 1
$nsg1 = New-AzNetworkSecurityGroup
-Name "nsg1"
-ResourceGroupName "TEST3"
-Location "japanEast"
-Name "rulerdp"
-NetworkSecurityGroup $nsg1
-Priority 4096
-SourceAddressPrefix "*"
-SourcePortRange "*"
-DestinationAddressPrefix "*"
-DestinationPortRange 3389
-Access "Allow"
-Protocol "Tcp"
-Name "ruleping"
-NetworkSecurityGroup $nsg1
-Priority 500
-SourceAddressPrefix "*"
-SourcePortRange "*"
-DestinationAddressPrefix "*"
-DestinationPortRange "*"
-Access "Allow"
-Protocol "Icmp"
# Créer le NSG 2
$nsg2 = New-AzNetworkSecurityGroup
-Name "nsg2"
-ResourceGroupName "TEST3"
-Location "japanEast"
-Name "rulerdp"
-NetworkSecurityGroup $nsg2
-Priority 4096
-SourceAddressPrefix "*"
-SourcePortRange "*"
-DestinationAddressPrefix "*"
-DestinationPortRange 22
-Access "Allow"
-Protocol "Tcp"
-Name "ruleping"
-NetworkSecurityGroup $nsg2
-Priority 500
-SourceAddressPrefix "*"
-SourcePortRange "*"
-DestinationAddressPrefix "*"
-DestinationPortRange "*"
-Access "Allow"
-Protocol "Icmp"
-Name "nic1"
-ResourceGroupName "TEST3"
-Location "japanEast"
-SubnetId $vnet1.Subnets[0].Id
-NetworkSecurityGroupId $nsg1.Id
# Créer la VM1
New-AzVM
-ResourceGroupName "TEST3"
-Name "vm1"
-Location "japanEast"
-Image "Win2016Datacenter"
-Size "Standard_D2s_V3"
-Credential (Get-Credential)
-NetworkInterfaceId $nic1.Id
-OsDiskName "diskvm1"
-OsDiskSizeInGB 256