SHARE
TWEET

Untitled

a guest Jan 21st, 2020 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. New-Azvm `
  2. -ResourceGroupName "myResourceGroup2" `
  3. -Name "myVM" `
  4. -Location "East US" `
  5. -VirtualNetworkName "myVnet2" `
  6. -SubnetName "mySubnet" `
  7. -SecurityGroupName "myNetworkSecurityGroup" `
  8. -PublicIpAddressName "myPublicIpAddress" `
  9. -OpenPorts 80
  10.  
  11.  
  12. Set-AzVMExtension -ResourceGroupName "myResourceGroup2" `
  13. -ExtensionName "IIS" `
  14. -VMName "myVM" `
  15. -Location "EastUS" `
  16. -Publisher Microsoft.Compute `
  17. -ExtensionType CustomScriptExtension `
  18. -TypeHandlerVersion 1.8 `
  19. -SettingString '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $($env:computername)"}'
  20.  
  21.  
  22. Get-AzPublicIPAddress -ResourceGroupName "myResourceGroup2" -Name "myPublicIPAddress" | select IpAddress
  23.  
  24. New-AzResourceGroup -Name myResourceGroupPS -Location eastus
  25. Connect-AzAccount
  26.  
  27. New-AzStorageAccount -ResourceGroupName myResourceGroupPS -Name "alexisgek" -Location eastus -SkuName Standard_LRS -Kind StorageV2
  28.  
  29.  
  30. New-AzResourceGroup -Name v1Storage -Location eastus
  31. New-AzStorageAccount -ResourceGroupName V1Storage -Name "bertje" -Location eastus -SkuName Standard_LRS -Kind Storage
  32.  
  33. New-AzStorageAccount -ResourceGroupName V1Storage -Name "jeroenpoepie" -Location eastus -SkuName Standard_LRS -Kind Storage
  34.  
  35.  
  36. $connectTestResult = Test-NetConnection -ComputerName bertje.file.core.windows.net -Port 445
  37. if ($connectTestResult.TcpTestSucceeded) {
  38.     # Save the password so the drive will persist on reboot
  39.     cmd.exe /C "cmdkey /add:`"bertje.file.core.windows.net`" /user:`"Azure\bertje`" /pass:`"9gNl4msVq0ycbr7W9ftHrTVmFUBwR+N2McTPvaXLxFyn8pTDWrdzNdTWsGSnffLbuJ2fKifDi3dDzp06ozsqTQ==`""
  40.     # Mount the drive
  41.     New-PSDrive -Name Q -PSProvider FileSystem -Root "\\bertje.file.core.windows.net\testpaulie"-Persist
  42. } else {
  43.     Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
  44. }
  45.  
  46.  
  47.  
  48. Set-AzStorageAccount -Name "bertje" -ResourceGroupName "v1Storage" -EnableHttpsTrafficOnly $True
  49.  
  50.  
  51.  
  52.  
  53. $virtualNetwork = New-AzVirtualNetwork -ResourceGroupName myResourceGroup -Location EastUS -Name myVirtualNetwork-PS -AddressPrefix 10.0.0.0/16
  54. $subnetConfig = Add-AzVirtualNetworkSubnetConfig -Name default -AddressPrefix 10.0.0.0/24 -VirtualNetwork $virtualNetwork
  55. $virtualNetwork | Set-AzVirtualNetwork
  56.  
  57.  
  58.  
  59. New-AzVM -ResourceGroupName "myResourceGroup" -Name "myVM-Static-PS" -Location "East US" -PublicIpAddressName "myPublicIpAddress-PS" -AllocationMethod "Static"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top