I have created a Powershell script that calls the Az module..."az network application-gateway probe create" - https://learn.microsoft.com/en-us/cli/azure/network/application-gateway/probe?view=azure-cli-latest#az-network-application-gateway-probe-create
I have read the documentation on the above command but can't work out how to set 'backend settings' - the field marked below by the black line as shown below - any thoughts?
The 'Backend Settings' field is a drop-down box that does list the 'http settings' I want to set the value to - remember I want to do this via; ARM or CLI not manually via the Azure Portal..
I tried to reproduce the same in my environment and got the results successfully like below:
To create the Probe and associated Backend settings, I used the below command while creating probe via CLI:
$probe = New-AzApplicationGatewayProbeConfig -Name probe01 -Protocol Http -HostName 'XXX.com' -Path '/path/path.htm' -Interval 30 -Timeout 120 -UnhealthyThreshold 8
$poolSetting = New-AzApplicationGatewayBackendHttpSettings -Name poolsetting01 -Port 80 -Protocol Http -CookieBasedAffinity Disabled -Probe $probe -RequestTimeout 80
I created the application gateway with all the required parameters like below:
$appgw = New-AzApplicationGateway -Name appgwtest -ResourceGroupName appgw-rg -Location 'West US' -BackendAddressPools $pool -Probes $probe -BackendHttpSettingsCollection $poolSetting -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $fp -HttpListeners $listener -RequestRoutingRules $rule -Sku $sku
In the Portal, Application Gateway created successfully with Backend settings like below:
To add a new probe to an existing application gateway and set Backend Settings, please use the below commands:
$appgw = Get-AzApplicationGateway -Name applicationgatewayname -ResourceGroupName ResourceGroupName
$probe = Add-AzApplicationGatewayProbeConfig -ApplicationGateway $appgw -Name probetest -Protocol Http -HostName 'XXX.com' -Path '/path/custompath.htm' -Interval 30 -Timeout 120 -UnhealthyThreshold 8
$appgw = Set-AzApplicationGatewayBackendHttpSettings -ApplicationGateway $appgw -Name $appgw.BackendHttpSettingsCollection.name -Port 80 -Protocol Http -CookieBasedAffinity Disabled -Probe $probe -RequestTimeout 120
Set-AzApplicationGateway -ApplicationGateway $appgw
Related
https://learn.microsoft.com/en-us/azure/application-gateway/tutorial-ssl-powershell
Hi All,
Using above link I'm able to create an application gateway with one Backend pool, with one Http settings, with one listener and with one rule.
But when it comes to Multiple Backend Pool, multiple Http settings, multiple listeners, multiple rules?
How do I define multiple Backend Pools, http settings, listeners and rules while creating Azure application gateway using PowerShell?
I have tested in my environment.
You can define multiple Backend Pools, http settings, listeners and rules while creating Azure application gateway using PowerShell
For defining multiple front end ports, use below command :
$frontendport1 = New-AzApplicationGatewayFrontendPort -Name FrontendPort1 -Port portnumber
$frontendport2 = New-AzApplicationGatewayFrontendPort -Name FrontendPort2 -Port portnumber
For defining multiple backend pools, use below command :
$backendPool1 = New-AzApplicationGatewayBackendAddressPool -Name AGBackendPool1
$backendPool2 = New-AzApplicationGatewayBackendAddressPool -Name AGBackendPool2
For defining multiple poolsettings, use below command :
$poolSettings1 = New-AzApplicationGatewayBackendHttpSetting -Name myPoolSettings1 -Port portnumber -Protocol Http -CookieBasedAffinity Enabled -RequestTimeout 30
$poolSettings2 = New-AzApplicationGatewayBackendHttpSetting -Name myPoolSettings2 -Port portnumber -Protocol Http -CookieBasedAffinity Enabled -RequestTimeout 30
For defining multiple listeners, use below command :
$defaultlistener1 = New-AzApplicationGatewayHttpListener -Name AGListener1 -Protocol Http -FrontendIPConfiguration $fipconfig -FrontendPort $frontendport1
$defaultlistener2 = New-AzApplicationGatewayHttpListener -Name AGListener2 -Protocol Http -FrontendIPConfiguration $fipconfig -FrontendPort $frontendport2
For defining multiple rules, use below command :
$frontendRule1 = New-AzApplicationGatewayRequestRoutingRule -Name rule1 -RuleType Basic -HttpListener $defaultlistener1 -BackendAddressPool $backendPool1 -BackendHttpSettings $poolSettings1
$frontendRule2 = New-AzApplicationGatewayRequestRoutingRule -Name rule2 -RuleType Basic -HttpListener $defaultlistener2 -BackendAddressPool $backendPool2 -BackendHttpSettings $poolSettings2
Now you can define this multiple Backend Pools, http settings, listeners and rules while creating Azure application gateway.
You can use below command to create Azure Application Gateway :
New-AzApplicationGateway -Name AppGatewayName -ResourceGroupName RGName -Location westus2 -BackendAddressPools $backendPool1, $backendPool2 -BackendHttpSettingsCollection $poolSettings1, $poolSettings2 -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $frontendport1, $frontendport2 -HttpListeners $defaultlistener1, $defaultlistener2 -RequestRoutingRules $frontendRule1, $frontendRule2 -Sku $sku
I am trying to add a new listener to existing Azure application gateway using powershell script. Here's the command I have used.
Add-AzApplicationGatewayHttpListener -ApplicationGateway $Appgw -Name $listenerName -FrontendIPConfiguration $fipconfig -FrontendPort $port -SslCertificate $cert -HostName $hostName -Protocol "Https" -Debug
All the variables are correctly initialized. Command executes well and return ApplicationGateway object which seems normal. However the newly added listener is not visible in Azure portal. After watching carefully the new listener in ApplicationGateway object (in powershell) it just show below resource path,
/subscriptions/<subscription-id>/resourceGroups/ResourceGroupNotSet/providers/Microsoft.Network/applicationGateways/ApplicationGatewayNameNotSet/httpListeners/<new-listener-name>
two things doesn't seem normal here,
ResourceGroupNotSet
ApplicationGatewayNameNotSet
Can anyone please suggest what could be the reason behind this? and why the listener is not shown in portal at all?
According to my test, if we want to add HTTP listener to existing Azure Application gateway with Powershell, we need to run the command Set-AzApplicationGateway -ApplicationGateway $appgw after you run the command Add-AzApplicationGatewayHttpListener. Because the command Add-AzApplicationGatewayHttpListener just will create a new HTTP listener but it will not update the application gateway.
Connect-AzAccount
$AppGWname ="stantest"
$groupName="stan"
$ipName="appGwPublicFrontendIp"
$portName="port_80"
$listenerName="test1"
$appgw= Get-AzApplicationGateway -Name $AppGWname -ResourceGroupName $groupName
$FEC= Get-AzApplicationGatewayFrontendIPConfig -Name $ipName -ApplicationGateway $appgw
Add-AzApplicationGatewayFrontendPort -ApplicationGateway $appgw -Name $portName -Port 80
$port =Get-AzApplicationGatewayFrontendPort -ApplicationGateway $appgw -Name $portName
Add-AzApplicationGatewayHttpListener -ApplicationGateway $appgw -Name $listenerName -FrontendIPConfiguration $FEC -FrontendPort $port -Protocol Http
Set-AzApplicationGateway -ApplicationGateway $appgw
I am trying to run the following commands to change the settings on an existing Rule in my Azure Application Gateway:
$updatedAppGW = Set-AzureRmApplicationGatewayRequestRoutingRule -ApplicationGateway $AppGW `
-Name $ChosenSubscription.httpsRule `
-RuleType Basic `
-BackendAddressPool $backendPool `
-BackendHttpSettings $httpSettings
# Save Gateway configuration
Write-Host "[$(__LINE__)] Attempting to save changes to the Application Gateway..." -ForegroundColor Cyan
Set-AzureRmApplicationGateway -ApplicationGateway $updatedAppGW | Out-Null
The Set-AzureRmApplicationGatewayRequestRoutingRule command appears to run correctly (silently, at least).
However, when I then try to "save" the Application Gateway configuration with the command Set-AzureRmApplicationGateway I receive the error Set-AzureRmApplicationGateway : Object reference not set to an instance of an object.
I think this is because I'm not using these "Set" commands correctly.
I read online that when I run Set-AzureRmApplicationGatewayRequestRoutingRule, I'm only actually making changes to the Rule in local memory. I then have to save the changes of the Application Gateway.
Is this true? If so... how do I actually save the Application Gateway configuration in this context? Earlier in my script, when using Add-AzureRm commands (such as Add-AzureRmApplicationGatewayBackendAddressPool), I've immediately (following line) run Set-AzureRmApplicationGateway and it has worked as intended.
I have also tried altering the Set-AzureRmApplicationGateway command in the code block at the top of this post to use my original $AppGW variable instead of this $updatedAppGW variable which I think my Set-AzureRmApplicationGatewayRequestRoutingRule command is producing. Neither works - identical error.
EDIT: Additional diagnosis
Adding the following Write-Host output...
Write-Host "[$(__LINE__)] Retrieved AG Rule '$($rule.Name)'." -ForegroundColor Magenta
Write-Host "[$(__LINE__)] Attempting to change this rule to point at Backend Address Pool '$($backendPool.Name)' and HTTP Settings '$($httpSettings.Name)'..." -ForegroundColor Cyan
# Re-retrieve the Application Gateway after saving it earlier
$AppGW = Get-AzureRmApplicationGateway -Name $ChosenSubscription.appGateway -ResourceGroupName $ChosenSubscription.resourceGroup
# Re-retrieve the Backend Address Pool and HTTP Settings that we've created, for the sake of updating the rule
$backendPool = Get-AzureRmApplicationGatewayBackendAddressPool -ApplicationGateway $AppGW -Name $MaintenanceToggleBackendPool
$httpSettings = Get-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $AppGW -Name $MaintenanceToggleHTTPSetting
Write-Host "[$(__LINE__)] `$AppGW.Name $($AppGW.Name)" -ForegroundColor Green
Write-Host "[$(__LINE__)] `$AppGW.ProvisioningState $($AppGW.ProvisioningState)" -ForegroundColor Green
Write-Host "[$(__LINE__)] `$AppGW.OperationalState $($AppGW.OperationalState)" -ForegroundColor Green
$updatedAppGW = Set-AzureRmApplicationGatewayRequestRoutingRule -ApplicationGateway $AppGW `
-Name $ChosenSubscription.httpsRule `
-RuleType Basic `
-BackendAddressPool $backendPool `
-BackendHttpSettings $httpSettings
Write-Host "[$(__LINE__)] `$updatedAppGW.Name $($updatedAppGW.Name)" -ForegroundColor Green
Write-Host "[$(__LINE__)] `$updatedAppGW.ProvisioningState $($updatedAppGW.ProvisioningState)" -ForegroundColor Green
Write-Host "[$(__LINE__)] `$updatedAppGW.OperationalState $($updatedAppGW.OperationalState)" -ForegroundColor Green
# Save Gateway configuration
Write-Host "[$(__LINE__)] Attempting to save changes to the Application Gateway..." -ForegroundColor Cyan
Set-AzureRmApplicationGateway -ApplicationGateway $updatedAppGW | Out-Null
... gives the following console output:
OK, managed to fix the problem myself... sigh
On the Set-AzureRmApplicationGatewayRequestRoutingRule command, you must specify the -HttpListener parameter, or it will fail silently.
# Re-retrieve the Backend Address Pool and HTTP Settings that we've created, for the sake of updating the rule
$backendPool = Get-AzureRmApplicationGatewayBackendAddressPool -ApplicationGateway $AppGW -Name $MaintenanceToggleBackendPool
$httpSettings = Get-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $AppGW -Name $MaintenanceToggleHTTPSetting
$httpListener = Get-AzureRmApplicationGatewayHttpListener -ApplicationGateway $AppGW -Name "HttpListenerTest"
$updatedAppGW = Set-AzureRmApplicationGatewayRequestRoutingRule -ApplicationGateway $AppGW `
-Name $ChosenSubscription.httpsRule `
-RuleType Basic `
-BackendAddressPool $backendPool `
-BackendHttpSettings $httpSettings `
-HttpListener $httpListener
This is why the Set-AzureRmApplicationGateway command wasn't working properly - it had a malformed RequestRoutingRule in its memory.
I am having problem deploying vmss using custom images via powershell. The following is my code for the powershell deployment:
#New-AzureRmResourceGroup -Location southeastasia -Name arkgenegroup1
# Resource group name from above
$rg = "myvmss"
$location = "southeastasia"
# Create a config object
$vmssConfig = New-AzureRmVmssConfig -Location $location -SkuCapacity 2 -SkuName Standard_A0 -UpgradePolicyMode Automatic
# Reference a virtual machine image from the gallery
Set-AzureRmVmssStorageProfile -VirtualMachineScaleSet $vmssConfig -OsDiskCreateOption FromImage -ManagedDisk StandardLRS -OsDiskCaching "None" -OsDiskOsType Linux -ImageReferenceId (Get-AzureRmImage -ImageName image200817 -ResourceGroupName $rg).id
# Set up information for authenticating with the virtual machine
Set-AzureRmVmssOsProfile $vmssConfig -AdminUsername admin -AdminPassword adminpass -ComputerNamePrefix myvmss
# Create the virtual network resources
## Basics
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name "my-subnet" -AddressPrefix 10.0.0.0/24
$vnet = New-AzureRmVirtualNetwork -Name "my-network" -ResourceGroupName $rg -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
## Load balancer
$publicIP = New-AzureRmPublicIpAddress -Name "PublicIP" -ResourceGroupName $rg -Location $location -AllocationMethod Static -DomainNameLabel "myuniquedomain"
$frontendIP = New-AzureRmLoadBalancerFrontendIpConfig -Name "LB-Frontend" -PublicIpAddress $publicIP
$backendPool = New-AzureRmLoadBalancerBackendAddressPoolConfig -Name "LB-backend"
$probe = New-AzureRmLoadBalancerProbeConfig -Name "HealthProbe" -Protocol Tcp -Port 80 -IntervalInSeconds 15 -ProbeCount 2
$inboundNATRule1= New-AzureRmLoadBalancerRuleConfig -Name "webserver" -FrontendIpConfiguration $frontendIP -Protocol Tcp -FrontendPort 80 -BackendPort 80 -IdleTimeoutInMinutes 15 -Probe $probe -BackendAddressPool $backendPool
$inboundNATPool1 = New-AzureRmLoadBalancerInboundNatPoolConfig -Name "RDP" -FrontendIpConfigurationId $frontendIP.Id -Protocol TCP -FrontendPortRangeStart 53380 -FrontendPortRangeEnd 53390 -BackendPort 3389
New-AzureRmLoadBalancer -ResourceGroupName $rg -Name "myLB" -Location $location -FrontendIpConfiguration $frontendIP -LoadBalancingRule $inboundNATRule1 -InboundNatPool $inboundNATPool1 -BackendAddressPool $backendPool -Probe $probe
## IP address config
$ipConfig = New-AzureRmVmssIpConfig -Name "my-ipaddress" -LoadBalancerBackendAddressPoolsId $backendPool.Id -SubnetId $vnet.Subnets[0].Id -LoadBalancerInboundNatPoolsId $inboundNATPool1.Id
# Attach the virtual network to the IP object
Add-AzureRmVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $vmssConfig -Name "network-config" -Primary $true -IPConfiguration $ipConfig
# Create the scale set with the config object (this step might take a few minutes)
New-AzureRmVmss -ResourceGroupName $rg -Name "myvmss" -VirtualMachineScaleSet $vmssConfig
Error Code
New-AzureRmVmss : Long running operation failed with status 'Failed'.
ErrorCode: DiskProcessingError
ErrorMessage: One or more errors occurred while preparing VM disks. See disk instance view for details.
StartTime: 8/21/2017 4:59:40 PM
EndTime: 8/21/2017 5:00:02 PM
OperationID: xxxxxxx-fda7-4f37-acbb-xxxxxxxx
Status: Failed
At line:1 char:1
+ New-AzureRmVmss -ResourceGroupName $rg -Name "myvmss" -VirtualMa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmVmss], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Common.ComputeCloudException,Microsoft.Azure.Commands.Compute.Automation.NewAzureRmVmss
I can't seems to figure out what exactly causing the problem, the same image was able to be used to create standalone VM.
I have test it in my lab, your script works for me, here is my result:
Get-AzureRmImage -ImageName image200817 -ResourceGroupName $rg
Does this image create by Azure VM?
If yes, we should use waagent command to delete machine specific files and data. SSH to your VM then type the following command:
sudo waagent -deprovision+user
Note:
Only run this command on a VM that you intend to capture as an image.
It does not guarantee that the image is cleared of all sensitive
information or is suitable for redistribution. The +user parameter
also removes the last provisioned user account. If you want to keep
account credentials in the VM, just use -deprovision to leave the user
account in place.
After run this command completed, we can use CLI to create VM image, we can follow those steps:
1.Deallocate the VM
az vm deallocate \
--resource-group myResourceGroup \
--name myVM
2.Mark the VM as generalized
az vm generalize \
--resource-group myResourceGroup \
--name myVM
3.create an image of the VM
az image create \
--resource-group myResourceGroup \
--name myImage --source myVM
After those script run completed, we can use your powershell script to deploy VMSS with that image.
More information about create an image of a virtual machine or VHD, please refer to this article.
I need to launch an IPv6 DNS query from my Azure VM. I need to control all the parameters of this query. I can do it via network calls or via the dig command. Can I do this with Azure? This probably: can the load balancer support an outbound IPv6 DNS query?
We needed to confirm that our DNS servers handled queries coming in over IPv6, and Azure was one of the cloud providers we could use. It wasn't easy, but I eventually got it to work.
In order to get outgoing IPv6 service from an Azure VM, the VM needs to be created in an availability set with a load balancer that has public dynamic IPv6 addresses, inbound NAT rules for both IPv4 and IPv6, and load balancing rules for same. Existing VMs can't be reconfigured to support this. Azure seems to create some some of tunnel between the configured load balancer and the VMs you put in the same availability set. This isn't obvious from the VM's perspective, except in that you can only communicate over IPv6 with the outside Internet and not with the other VMs in your Azure submit.
IPv6 support isn't currently possible to configure through the Azure portal. I made heavy use of the following two links to get this working:
https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-ipv6-overview
https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-ipv6-internet-ps
You'll need a Windows VM to run much of the above; PowerShell for Linux and AzureRM.NetCore.Preview does not have feature parity with PowerShell in Windows.
I had to hack at the above example for some time before coming up with the following ... you may need to hack it some more to work in your environment.
Note that I ran this script from within Powershell ISE so I could pre-configure the environment with $mySecureCredentials and Login-AzureRMAccount as necessary.
The below will create a Centos 7.3 VM that can initiate IPv6 DNS queries against the Internet. Note that you'll have to enable your IPv6 interfaces in the guest after rebooting. Unfortunately my rep is too low to post more than 2 links, so search for 'azure linux dhcp ipv6' to see how enable DHCPv6 client configuration on your VM.
$resgroupName = 'YourResourceGroup'
$location = 'east US' # of course, select your preferred location
# you will need some secure credentials. run something like:
# $mySecureCredentials = Get-Credential -Message "Type the username and password of the local administrator account."
# you will also need to log into azure (Login-AzureRMAccount)
# IP addresses, load balancer config
$publicIPv4= New-AzureRmPublicIpAddress -name 'lb-pub-ipv4' -ResourceGroupName $resgroupName -location $location `
-Allocationmethod Static -IpAddressVersion IPv4 -domainnamelabel my-lbnrpipv4
$publicIPv6 = New-AzureRmPublicIpAddress -name 'lb-pub-ipv6' -ResourceGroupName $resgroupName -location $location `
-AllocationMethod Dynamic -IpAddressVersion IPv6 -DomainNameLabel my-lbnrpipv6
$FEIPConfigv4 = New-AzureRmLoadBalancerFrontendIpConfig -name "LB-Frontendv4" -PublicIpAddress $publicIPv4
$FEIPConfigv6 = New-AzureRmLoadBalancerFrontendIpConfig -name "LB-Frontendv6" -PublicIpAddress $publicIPv6
$backendpoolipv4 = New-AzureRmLoadBalancerBackendAddressPoolConfig -name "BackendPoolIPv4"
$backendpoolipv6 = New-AzureRmLoadBalancerBackendAddressPoolConfig -name "BackendPoolIPv6"
# This script assumes you already have a virtual network defined - replace myRG-vnet with the name of the virtual network you want to use.
$vnet = Get-AzureRmVirtualNetwork -name myRG-vnet -ResourceGroupName $resgroupName
# I assume you want to use the default subnet.
$backendSubnet = Get-AzureRmVirtualNetworkSubnetConfig -name default -virtualnetwork $vnet
# Create NAT rules for load balancer
# Even if you don't actually need any inbound rules, some rules appear to be necessary to make outbound IPv6 work.
# Inbound SSH
$inboundNATRule1v4 = New-AzureRmLoadBalancerInboundNatRuleConfig -name "NicNatRulev4" -FrontendIpConfiguration $FEIPConfigv4 -Protocol TCP -FrontendPort 22 -BackendPort 22
$inboundNATRule1v6 = New-AzureRmLoadBalancerInboundNatRuleConfig -name "NicNatRulev6" -FrontendIpConfiguration $FEIPConfigv6 -Protocol TCP -FrontendPort 22 -BackendPort 22
$lbrule1v4 = New-AzureRmLoadBalancerRuleConfig -name "HTTPv4" -FrontendIpConfiguration $FEIPConfigv4 -BackendAddressPool $backendpoolipv4 -Protocol TCP -FrontendPort 80 -BackendPort 80
$lbrule1v6 = New-AzureRmLoadBalancerRuleConfig -name "HTTPv6" -FrontendIpConfiguration $FEIPConfigv6 -BackendAddressPool $backendpoolipv6 -Protocol TCP -FrontendPort 80 -BackendPort 80
$NRPLB = New-AzureRmLoadBalancer -ResourceGroupName $resgroupName -name 'myNrpIPv6LB' -location $location `
-FrontendIpConfiguration $FEIPConfigv4,$FEIPConfigv6 -BackendAddressPool $backendpoolipv4,$backendpoolipv6 `
-LoadBalancingRule $lbrule1v4,$lbrule1v6 -inboundNatRule $inboundNATRule1v4,$inboundNATRule1v6
$nic1IPv4 = New-AzureRmNetworkInterfaceIpConfig -name "IPv4IPConfig" -PrivateIpAddressVersion "IPv4" -subnet $backendSubnet -LoadBalancerBackendAddressPool $backendpoolipv4 -LoadBalancerInboundNatRule $inboundNATRule1v4
$nic1IPv6 = New-AzureRmNetworkInterfaceIpConfig -name "IPv6IPConfig" -PrivateIpAddressVersion "IPv6" -LoadBalancerBackendAddressPool $backendpoolipv6 -LoadBalancerInboundNatRule $inboundNATRule1v6
$nic1 = New-AzureRmNetworkInterface -Name 'myNrpIPv6Nic0' -IpConfiguration $nic1IPv4,$nic1IPv6 `
-resourceGroupName $resgroupName -location $location
New-AzureRmAvailabilitySet -name "myNrpIPv6AvSet" -resourcegroupname $resgroupName -location $location
$avset1 = Get-AzureRmAvailabilitySet -resourcegroupname $resgroupName -name 'myNrpIPv6AvSet'
try {
New-AzureRmStorageAccount -ResourceGroupName $resgroupName -name 'mynrpipv6stacct' -location $location -skuname `
"Standard_LRS" -erroraction stop
} catch {
echo "new storage account failed, let's just hope it was a dup and gets found anyway"
}
# find my existing storage account
$storAcct = Get-AzureRmStorageAccount -resourcegroupname $resgroupName -name 'mynrpipv6stacct'
if ($storAcct -eq $null) {
throw "I could not find a storage accoount"
}
$nic1 = Get-AzureRmNetworkInterface -ResourceGroupName $resgroupName -name 'myNrpIPv6Nic0'
$vm1 = New-AzureRmVMConfig -vmName 'myNrpLinuxIPv6VM1' -vmSize 'Standard_d1' -AvailabilitySetId $avset1.Id
$vm1 = Set-AzureRmVMOperatingSystem -vm $vm1 -Linux -ComputerName 'myNrpLinuxIPv6VM1' -Credential $mySecureCredentials
$vm1 = Set-AzureRmVMSourceImage -VM $vm1 -PublisherName OpenLogic -Offer CentOS -Skus '7.3' -Version "latest"
$vm1 = Add-AzureRmVMNetworkInterface -VM $vm1 -Id $nic1.Id -Primary
$osDisk1Uri = $storAcct.PrimaryEndpoints.Blob.ToString() + "vhds/myNrpLinuxIPv6VM1osdisk.vhd"
$vm1 = Set-AzureRmVMOSDisk -VM $vm1 -Name 'myNrpLinuxIPv6VM1osdisk' -VhdUri $osDisk1Uri -CreateOption FromImage
echo now creating...
new-azurermvm -ResourceGroupName $resgroupName -location $location -VM $vm1
echo done
I don't understand what you mean by launch an IPv6 query. Do you mean query for an AAAA record or do you mean IPv6 network traffic? If you meant he query type then tools like nslookup and dig allow you to control the query but when looking up a hostname in things like browsers they let the OS decide how to resolve the name, that's not Azure specific. If you're talking about IP level traffic, the Azure DNS recursive resolvers are only contactable using IPv4 at present.