New-AzureRmApiManagementApi
Creates an API.
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
New-AzureRmApiManagementApi
-Context <PsApiManagementContext>
[-ApiId <String>]
-Name <String>
[-Description <String>]
-ServiceUrl <String>
-Path <String>
-Protocols <PsApiManagementSchema[]>
[-AuthorizationServerId <String>]
[-AuthorizationScope <String>]
[-SubscriptionKeyHeaderName <String>]
[-SubscriptionKeyQueryParamName <String>]
[-ProductIds <String[]>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzureRmApiManagementApi cmdlet creates an Azure API Management API.
Examples
Example 1: Create an API
PS C:\>$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>New-AzureRmApiManagementApi -Context $ApiMgmtContext -Name "Echo api" -ServiceUrl "https://contoso.com/apis/echo" -Protocols @("http", "https") -Path "testapi"
This command creates an API named EchoApi with the specified URL.
Parameters
-ApiId
Specifies the ID of the API to create. If you do not specify this parameter, this cmdlet generates an ID for you.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-AuthorizationScope
Specifies the OAuth operations scope. The default value is $Null.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-AuthorizationServerId
Specifies the OAuth authorization server ID. The default value is $Null. You must specify this parameter if AuthorizationScope is specified.
Type: | String |
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 |
-Description
Specifies a description for the web API.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
Specifies the name of the web API. This is the public name of the API as it appears on the developer and admin portals.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Path
Specifies the web API path, which is the last part of the API's public URL and corresponds to the Web API URL suffix field in the admin portal. This URL is used by API consumers to send requests to the web service, and must be one to 400 characters long. The default value is $Null.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ProductIds
Specifies an array of product IDs to which to add the new API.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Protocols
Specifies an array of web API protocols. Valid values are http, https. These are the web protocols over which the API is made available. The default value is $Null.
Type: | PsApiManagementSchema[] |
Accepted values: | Http, Https |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServiceUrl
Specifies the URL of the web service that exposes the API. This URL is used only by Azure API Management, and is not made public. The URL must be one to 2000 characters long.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SubscriptionKeyHeaderName
Specifies the subscription key header name. The default value is $Null.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SubscriptionKeyQueryParamName
Specifies the subscription key query string parameter name. The default value is $Null.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
String[]