This article is contributed. See the original author and article here.

This article describes to check your quota and what should be your next when you reach Synapse workspace default limit.


If you exceeds workspace limits the error message you receive is – “ReachedPerSubscriptionWorkspaceLimit: Reached the maximum number of workspaces allowed for Subscription”


 Facts: 


Current default limit is 20 Synapse workspaces per subscription/region. i.e.  There is a limit of 20 SQL servers per subscription by default.


Check Details about your subscription and workspaces:


Get the details about the workspace created in your subscription. This will help to optimize your resources



  1. Check for workspaces created and regions available to the subscription.


 



  • Using Rest API


Following are list Rest APIs for Synapse


Azure Synapse Analytics REST API Reference | Microsoft Docs



  1. Available Regions


Ref document:  Providers – Get (Azure Resource Management) | Microsoft Docs


 


GET https://management.azure.com/subscriptions/{SuBGUID}/providers/Microsoft.Synapse?api-version=2020-06-01


 



  1. Workspaces List


Workspaces – List (Azure Synapse) | Microsoft Docs


GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces?api-version=2019-06-01-preview


 



  • Using PoweShell script


Run following script in PowerShell 7


 

$SubscriptionId ={SubscriptionId}

 
# ------------------------------------------------------------------
 
# first login to Azure Account
Write-Host "Connecting to Azure Account..."
if((Get-AzContext) -eq $null)
{
    Connect-AzAccount
}
 
# set subscription context
Write-Host "Selecting subscription..."
$context = Set-AzContext -Subscription $SubscriptionId
 
# get AAD token for REST calls
Write-Host "Getting Bearer token from AAD for REST calls..."
$apiToken = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.AuthenticationFactory.Authenticate($context.Account, $context.Environment, $context.Tenant.Id, $null, "Never", $null)
$headers = @{ 'authorization' = ('Bearer {0}' -f ($apiToken.AccessToken)) }
 
# Get Locations where Synapse is available
Write-Host "Getting Locations where Synapse is available..."
$synapseLocations = Get-AzLocation | Where-Object { $_.Providers -contains "Microsoft.Synapse" } | Sort-Object Location | Select-Object Location, DisplayName
 
# ------------------------------------------------------------------------------
# get subscription quota and regional available SLOs for Synapse SQL
 
Write-Host "Getting subscription quota settings for Synapse..."
$quotaResults = [System.Collections.ObjectModel.Collection[psobject]]@()
 
foreach($location in $synapseLocations)
{
    # ------------------
    # available slos
    # https://docs.microsoft.com/en-us/rest/api/sql/capabilities/listbylocation
    $capabilitiesUri = "https://management.azure.com/subscriptions/$SubscriptionId/providers/Microsoft.Sql/locations/$($location.Location)/capabilities?api-version=2020-08-01-preview"
    $regionalCapabilities = ConvertFrom-Json (Invoke-WebRequest -Method Get -Uri $capabilitiesUri -Headers $headers).Content
    
    # ------------------------------------
 
    $quotaResults += [PSCustomObject]@{
        Location = $location.Location;
        DisplayName = $location.DisplayName;
        Status = $regionalCapabilities.status;
    }
}
 
$quotaResults | ft -AutoSize

 


Sample output.


tejalsd_0-1611790550153.png


 



  1. Check details about usage matrix for SQL Pools


 



  • Using Rest API.


Workspace Managed Sql Server Usages – List (Azure Synapse) | Microsoft Docs


GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlUsages?api-version=2019-06-01-preview


 



  • Using PowerShell


Use following script in PowerShell 7

$SubscriptionId ={SubscriptionId}
# ------------------------------------------------------------------
# first login to Azure Account
Write-Host "Connecting to Azure Account..."
if((Get-AzContext) -eq $null)
{
    Connect-AzAccount
}
# set subscription context
Write-Host "Selecting subscription..."
$context = Set-AzContext -Subscription $SubscriptionId
# get AAD token for REST calls
Write-Host "Getting Bearer token from AAD for REST calls..."
$apiToken = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.AuthenticationFactory.Authenticate($context.Account, $context.Environment, $context.Tenant.Id, $null, "Never", $null)
$headers = @{ 'authorization' = ('Bearer {0}' -f ($apiToken.AccessToken)) }
# ------------------------------------------------------------------------------
# SQL server DTU limits
Write-Host "Getting SQL DTU limits..."
# all servers in this subscription for SQL
# https://docs.microsoft.com/en-us/rest/api/sql/servers/list
# GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers?api-version=2019-06-01-preview
$serversUri = "https://management.azure.com/subscriptions/$SubscriptionId/providers/Microsoft.Sql/servers?api-version=2019-06-01-preview"
$serverList = (ConvertFrom-Json (Invoke-WebRequest -Method Get -Uri $serversUri -Headers $headers).Content).value
$serverQuotas = @()
foreach($server in $serverList)
{
    # usage detail of indiviual server
    # https://docs.microsoft.com/en-us/rest/api/sql/servers/usages
    # GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages?api-version=2014-01-01
    $serverQuotaUri = "https://management.azure.com$($server.id)/usages?api-version=2014-01-01"
    $serverQuota = (ConvertFrom-Json (Invoke-WebRequest -Method Get -Uri $serverQuotaUri -Headers $headers).Content).value
$serverQuotas += [PSCustomObject]@{
        Location = $server.location;
        Id = $server.id;
        Name = $server.name;
        CurrentDTU = ($serverQuota | ? { $_.name -eq 'server_dtu_quota_current' }).currentValue;
        DTULimit = ($serverQuota | ? { $_.name -eq 'server_dtu_quota_current' }).limit;
    }
}
$serverQuotas | Sort-Object Location, Name | ft Location, Name, CurrentDTU, DTULimit -AutoSize

 


 


Sample result


tejalsd_1-1611790550157.png


 


 


Next Step: If you want to increase the quota, feel free to contact us through @ support .

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.