Skip to content

Get-ElasticPool

Azure: Gets Azure SQL Elastic Pools

param(
	[Parameter(Mandatory = $true)]
	[string]$ResourceGroupName,

	[Parameter(Mandatory = $true)]
	[string]$ServerName,

	[Parameter(Mandatory = $false)]
	[string]$ElasticPoolName
)

try {
	Import-Module Az.Sql -ErrorAction Stop
	
	[hashtable]$cmdArgs = @{ 'ResourceGroupName' = $ResourceGroupName; 'ServerName' = $ServerName; 'ErrorAction' = 'Stop' }
	if ($ElasticPoolName) { $cmdArgs.Add('ElasticPoolName', $ElasticPoolName) }

	$pools = Get-AzSqlElasticPool @cmdArgs
	Write-Output $pools
} catch {
	Write-Error $_
	exit 1
}

The name of the resource group.

The name of the Azure SQL Server.

The name of the Elastic Pool (optional).

An interactive directory of PowerShell scripts.