Import-AzureRmApiManagementApi

Imports an API from a file or a URL.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Import-AzureRmApiManagementApi
      -Context <PsApiManagementContext>
      [-ApiId <String>]
      [-ApiRevision <String>]
      -SpecificationFormat <PsApiManagementApiFormat>
      -SpecificationPath <String>
      [-Path <String>]
      [-WsdlServiceName <String>]
      [-WsdlEndpointName <String>]
      [-ApiType <PsApiManagementApiType>]
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]
Import-AzureRmApiManagementApi
      -Context <PsApiManagementContext>
      [-ApiId <String>]
      [-ApiRevision <String>]
      -SpecificationFormat <PsApiManagementApiFormat>
      -SpecificationUrl <String>
      [-Path <String>]
      [-WsdlServiceName <String>]
      [-WsdlEndpointName <String>]
      [-ApiType <PsApiManagementApiType>]
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]

Description

The Import-AzureRmApiManagementApi cmdlet imports an Azure API Management API from a file or a URL in Web Application Description Language (WADL), Web Services Description Language (WSDL), or Swagger format.

Examples

Example 1 Import an API from a WADL file

PS C:\>$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Import-AzureRmApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Wadl" -SpecificationPath "C:\contoso\specifications\echoapi.wadl" -Path "apis"

This command imports an API from the specified WADL file.

Example 2 Import an API from a Swagger file

PS C:\>$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Import-AzureRmApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Swagger" -SpecificationPath "C:\contoso\specifications\echoapi.swagger" -Path "apis"

This command imports an API from the specified Swagger file.

PS C:\>$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Import-AzureRmApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Wadl" -SpecificationUrl "http://contoso.com/specifications/wadl/echoapi" -Path "apis"

This command imports an API from the specified WADL link.

Parameters

-ApiId

Specifies an ID for the API to import. If you do not specify this parameter, an ID is generated for you.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ApiRevision

Identifier of API Revision. This parameter is optional. If not specified, the import will be done onto the currently active revision or a new api.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ApiType

This parameter is optional with a default value of Http. The Soap option is only applicable when importing WSDL and will create a SOAP Passthrough API.

Type:Nullable<T>[PsApiManagementApiType]
Accepted values:Http, Soap
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Context

Specifies a PsApiManagementContext object.

Type:PsApiManagementContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

Specifies a web API path as the last part of the API's public URL. This URL is used by API consumers for sending requests to the web service. Must be 1 to 400 characters long. The default value is $Null.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-SpecificationFormat

Specifies the specification format. psdx_paramvalues Wadl, Wsdl, and Swagger.

Type:PsApiManagementApiFormat
Accepted values:Wadl, Swagger, Wsdl
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SpecificationPath

Specifies the specification file path.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SpecificationUrl

Specifies the specification URL.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WsdlEndpointName

Local name of WSDL Endpoint (port) to be imported. Must be 1 to 400 characters long. This parameter is optional and only required for importing Wsdl. Default value is $null.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WsdlServiceName

Local name of WSDL Service to be imported. Must be 1 to 400 characters long. This parameter is optional and only required for importing Wsdl . Default value is $null.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

PsApiManagementContext

String

PsApiManagementApiFormat

Nullable<T>[[Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementApiType, Microsoft.Azure.Commands.ApiManagement.ServiceManagement, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null]]

Outputs

PsApiManagementApi