framework/Resources/Scripts/get_all_vms.ps1
|
Param( [Parameter(Mandatory)] [string]$EnvironmentName, [string]$ScriptsFolderPath = ".\Resources\Scripts" ) . "$ScriptsFolderPath\common.ps1" $resourceGroup = $null function ExecuteCommand { $global:resourceGroup = CheckIfEnvironmentExits -Environment $EnvironmentName return GetServers } function GetServers { return GetNCacheServers -rgName $($global:resourceGroup.ResourceGroupName) } try { ShowExecutingCommand if (-not (Get-AzContext)) { Connect-AzAccount if (Get-AzContext) { return ExecuteCommand } } else { return ExecuteCommand } } catch { Write-Error $($_.Exception.Message) } |