Azure API Management PowerShell Reference

Discover and manage your Azure API Management services with the Az.ApiManagement module.

Module Overview

The Az.ApiManagement module provides cmdlets to manage Azure API Management services. You can use this module to perform various operations, including creating, configuring, and monitoring your API Management instances.

Key features include:

Getting Started

To use the Az.ApiManagement cmdlets, you first need to install the Azure PowerShell module and then import the Az.ApiManagement module.

# Install Azure PowerShell module (if not already installed)
Install-Module -Name Az -AllowClobber -Scope CurrentUser

# Connect to your Azure account
Connect-AzAccount

# Import the API Management module
Import-Module Az.ApiManagement

Once connected and the module is imported, you can start using the cmdlets.

Cmdlets Reference

Explore the extensive list of cmdlets available in the Az.ApiManagement module to manage your API Management resources.

Service Management

Cmdlets for creating, updating, and deleting API Management services.

  • New-AzApiManagement
  • Get-AzApiManagement
  • Set-AzApiManagement
  • Remove-AzApiManagement
  • Test-AzApiManagementName
View Cmdlets

API & Operation Management

Manage your APIs, operations, and their definitions.

  • New-AzApiManagementApi
  • Get-AzApiManagementApi
  • Set-AzApiManagementApi
  • Remove-AzApiManagementApi
  • New-AzApiManagementApiOperation
  • Get-AzApiManagementApiOperation
View Cmdlets

Policy Management

Configure policies for your APIs and operations.

  • Get-AzApiManagementPolicy
  • Set-AzApiManagementPolicy
  • Get-AzApiManagementPolicyFragment
  • New-AzApiManagementPolicyFragment
View Cmdlets

Product & Subscription Management

Control access to your APIs through products and subscriptions.

  • New-AzApiManagementProduct
  • Get-AzApiManagementProduct
  • Set-AzApiManagementProduct
  • Remove-AzApiManagementProduct
  • New-AzApiManagementSubscription
  • Get-AzApiManagementSubscription
View Cmdlets

User Management

Manage user accounts for your API Management service.

  • New-AzApiManagementUser
  • Get-AzApiManagementUser
  • Set-AzApiManagementUser
  • Remove-AzApiManagementUser
View Cmdlets

Diagnostic & Monitoring

Enable and configure diagnostics and log data.

  • Set-AzApiManagementDiagnostics
  • Get-AzApiManagementDiagnostics
  • Get-AzApiManagementGateway
  • Set-AzApiManagementGateway
View Cmdlets

Practical Examples

See how to use common cmdlets to manage your API Management resources.

# Example 1: Create a new API Management service
New-AzApiManagement -ResourceGroupName "MyResourceGroup" -Name "my-apim-service" -Location "West US" -Sku "Developer"

# Example 2: Get all APIs for a service
Get-AzApiManagementApi -ApiManagementServiceName "my-apim-service" -ResourceGroupName "MyResourceGroup"

# Example 3: Set a policy for a specific API operation
$policyXml = @"
<policies>
    <inbound>
        <base />
        <set-header name="X-Powered-By" exists-action="override">
            <value>Azure API Management</value>
        </set-header>
    </inbound>
    <backend>
        <base />
    </backend>
    <outbound>
        <base />
    </outbound>
    <on-error>
        <base />
    </on-error>
</policies>
"@
Set-AzApiManagementPolicy -ApiManagementServiceName "my-apim-service" -ResourceGroupName "MyResourceGroup" -ApiId "my-api-id" -Policy $policyXml

# Example 4: Create a new product
New-AzApiManagementProduct -ApiManagementServiceName "my-apim-service" -ResourceGroupName "MyResourceGroup" -ProductId "bronze" -DisplayName "Bronze Tier" -Description "Basic access tier." -SubscriptionRequired $true

Further Resources