Cloud Shell에서 하면 최초 인증작업 필요없음.
$location = 'koreacentral' $vmName = 'testcompevm1' $rgName = 'RGeastus2' $nicName = 'comp-test-ccc-vm01-nic' $pipName = 'comp-test-ccc-vm01-pip' $azureVmOsDiskName = 'comp-test-ccc-vm01-osdisk' $datadiskName = 'comp-test-ccc-vm01-disk' $adminName = 'bigcccmgr01' $VMAdminPassword = 'cccP@a!xtnV7X' $vmSize = 'Standard_B1ms' $vnetName = 'vnet01' $subnet1Name = 'default' # 1번 # public ip address $pip = New-AzureRmPublicIpAddress -Name $pipName -ResourceGroupName $rgName -Location $location -AllocationMethod Static # 2번 # vnet 확인 $vnet = Get-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $rgName # 3번 # 서브넷 config $subnetconfig = Get-AzureRmVirtualNetworkSubnetConfig -Name $subnet1Name -VirtualNetwork $vnet # 4번 #계정정보 $password = $VMAdminPassword | ConvertTo-SecureString -AsPlainText -Force $cred = New-Object PSCredential ($adminName, $password) $vm = New-AzureRmVMConfig -VMName $VMName -VMSize $vmSize # 5번 #nic 생성 $nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $location -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id # 6번 #vm 준비 $vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $vmName -Credential $cred $vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName 'MicrosoftWindowsServer' -Offer 'WindowsServer' -Skus '2012-R2-Datacenter' -Version 'latest' $vm = Set-AzureRmVMOSDisk -VM $vm -StorageAccountType 'Standard_LRS' -Name $azureVmOsDiskName -CreateOption FromImage $vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm $VirtualMachine = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName $vmDataDisk01Config = New-AzureRmDiskConfig -SkuName Standard_LRS -Location $location -CreateOption Empty -DiskSizeGB 50 $vmDataDisk01 = New-AzureRmDisk -DiskName $datadiskName -Disk $vmDataDisk01Config -ResourceGroupName $rgName $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name $datadiskName -Lun 0 -CreateOption Attach -ManagedDiskId $vmDataDisk01.Id Update-AzureRmVM -ResourceGroupName $rgName -VM $VirtualMachine
'기술(Azure 만...) > [MS]Azure기본' 카테고리의 다른 글
2021 new VMSS (가상머신 확장집합 새로운 기능) (0) | 2021.04.02 |
---|---|
Azure RI Reserved Instance 핵심요약 & Tip (0) | 2021.02.13 |
Azure Active Directory 일반 (0) | 2020.09.08 |
azure 거버넌스 (0) | 2020.09.06 |
AAD 단계별 배포전략 요건정의 (0) | 2020.08.03 |