注意這是執行 .ps1 的時候用的指令,普通開 PowerShell 視窗用 Get-Location
$MyInvocation.MyCommand (PowerShell 系統保留變數)
($MyInvocation.MyCommand).Path
$pid (PowerShell 系統保留變數)
寫入一個與 .ps1 主檔名相同、副檔名為 pid、內容為 pid 的檔案
注意這是執行 .ps1 的時候用的指令,普通開 PowerShell 視窗用 Get-Location
$MyInvocation.MyCommand (PowerShell 系統保留變數)
($MyInvocation.MyCommand).Path
$pid (PowerShell 系統保留變數)
寫入一個與 .ps1 主檔名相同、副檔名為 pid、內容為 pid 的檔案
Import-Module -Name Az
# Create a VNet with a Site-to-Site VPN connection using PowerShell
# https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-create-site-to-site-rm-powershell
$RegionLocation = 'Japan East';
$ResourceGroupName = 'Infra_Network';
$vNetName = 'Corp-vNet';
$VirtualNetworkGateway_PublicIP_Name = 'Azure_VPN_IP';
$VirtualNetworkGateway_Name = 'Azure_VPN_Gateway';
$LocalNetworkGateway_Name = 'Local_VPN_Gateway';
$AzureVPNConnection_Name = 'Azure_VPN_Connection';
$VPNSharedKey = (("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".tochararray() | sort {Get-Random})[0..32] -join '');
$GatewaySku = 'Basic';
$LocalNetworkIPAddress = '168.95.1.1';
$LocalNetworkAddressSpace = @('10.255.0.0/16');
$LocalRRAS_VPNName = 'AzureVPN';
$LocalDNSServer_Object = New-Object -Type PSObject -Property @{"DnsServers" = @("10.10.10.11")};