• Improve this Doc

    Show / Hide Table of Contents

    How to retrieve your subscription quotas using PowerShell

    Overview

    Quotas define the limit of the number of resources that a subscription can provision or consume.

    The following process shows you how to retrieve the quotas for your subscription, as well as the current usage.

    Prerequisites

    Ensure your PowerShell environment is setup as detailed in Configure the Azure Stack Hub user's PowerShell environment.

    Declare variables

    Enter details below to provide values for the variables in the scripts in this article:

    Variable name Variable description Input
    $ArmEndpoint The Azure Resource Manager endpoint for Azure Stack Hub

    Retrieving your quota

    From your PowerShell window:

    # Declare endpoint
    $ArmEndpoint = "https://management.frn00006.azure.ukcloud.com"
    
    # Add environment
    Add-AzureRmEnvironment -Name "AzureStackUser" -ArmEndpoint $ArmEndpoint
    
    # Login
    Connect-AzureRmAccount -EnvironmentName "AzureStackUser"
    
    # Get location of Azure Stack Hub
    $Location = (Get-AzureRmLocation).Location
    
    # Retrieve Compute quota
    $ComputeQuota = Get-AzureRmVMUsage -Location $Location | Select-Object -Property Name, CurrentValue, Limit
    $ComputeQuota | ForEach-Object {
        if (-not $_.Name.LocalizedValue) {
            $_.Name = $_.Name.Value -creplace '(\B[A-Z])', ' $1'
        }
        else {
            $_.Name = $_.Name.LocalizedValue
        }
    }
    
    # Retrieve Storage quota
    $StorageQuota = Get-AzureRmStorageUsage | Select-Object -Property Name, CurrentValue, Limit
    
    # Retrieve Network quota
    $NetworkQuota = Get-AzureRmNetworkUsage -Location $Location | Select-Object @{ Label="Name"; Expression={ $_.ResourceType } }, CurrentValue, Limit
    
    # Combine quotas
    $AllQuotas = $ComputeQuota + $StorageQuota + $NetworkQuota
    
    # Export quota to CSV
    $AllQuotas | Export-Csv -Path "AzureStackQuotas.csv" -NoTypeInformation
    

    Feedback

    If you find an issue with this article, click Improve this Doc to suggest a change. If you have an idea for how we could improve any of our services, visit the Ideas section of the UKCloud Community.

    Generated by DocFX
    Back to top
    © UKCloud Ltd, 2019. All Rights Reserved.
    Privacy Policy. Terms of Use. Contribute.

    UKCloud Knowledge Centre uses cookies to ensure that we give you the best experience on our website. If you continue we assume that you consent to receive all cookies on this website.