简体   繁体   中英

How to get the Virtual IP Address associated with a Azure App Service via Powershell

I'm trying to do an IP changeover and I'm looking to get the Virtual IP of all our app service instances.

So far I've put together the following powershell script:

$apps = Get-AzureRmWebApp 
Foreach($app in $apps) 
{ 
  Write-Output "$($app.Name)|$($app.OutboundIpAddresses)"

  ($app | Get-AzureDeployment -Slot Production).VirtualIPs[0].Address

  break;
}

But I'm stuck at the Get-AzureDeployment step - I think there should be a RM version of this, but I can't find it.

Related GitHub issue - this indicates it does exist: https://github.com/Azure/azure-powershell/issues/1648

I'm trying to get to the Virtual Ip Address as per the below screenshot:

在此处输入图片说明

If you want to get the VIRTUAL IP ADDRESS , you could use the command below.

$slot = Get-AzureRmWebAppSlot -ResourceGroupName "<ResourceGroupName>" -Name "<yourwebappname>" -Slot "<yourslotname>" 
($slot.OutboundIpAddresses -split ",")[0]

在此处输入图片说明

Your complete command should be:

    $apps = Get-AzureRmWebApp 
    Foreach($app in $apps) 
    { 
      Write-Output "$($app.Name)|$($app.OutboundIpAddresses)"

      $slot = Get-AzureRmWebAppSlot -ResourceGroupName $app.ResourceGroup -Name $app.Name -Slot "<yourslotname>" 
      ($slot.OutboundIpAddresses -split ",")[0]

      break;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM