Skip to content

New-ElasticPool

Azure: Creates an Azure SQL Elastic Pool

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

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

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

	[Parameter(Mandatory = $false)]
	[string]$Edition,

	[Parameter(Mandatory = $false)]
	[int]$Dtu
)

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

	$pool = New-AzSqlElasticPool @cmdArgs
	Write-Output $pool
} catch {
	Write-Error $_
	exit 1
}

The name of the resource group.

The name of the Azure SQL Server.

The name for the new Elastic Pool.

The edition of the pool (e.g. Basic, Standard, Premium).

The DTU limit for the pool.

An interactive directory of PowerShell scripts.