Upravit

Sdílet prostřednictvím


Set-AzApiManagementApi

Modifies an API.

Syntax

Set-AzApiManagementApi
   -Context <PsApiManagementContext>
   -ApiId <String>
   [-Name <String>]
   [-Description <String>]
   [-ServiceUrl <String>]
   [-Path <String>]
   [-Protocols <PsApiManagementSchema[]>]
   [-AuthorizationServerId <String>]
   [-AuthorizationScope <String>]
   [-OpenIdProviderId <String>]
   [-BearerTokenSendingMethod <String[]>]
   [-SubscriptionKeyHeaderName <String>]
   [-SubscriptionKeyQueryParamName <String>]
   [-SubscriptionRequired]
   [-PassThru]
   [-ApiType <PsApiManagementApiType>]
   [-TermsOfServiceUrl <String>]
   [-ContactName <String>]
   [-ContactUrl <String>]
   [-ContactEmail <String>]
   [-LicenseName <String>]
   [-LicenseUrl <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Set-AzApiManagementApi
   -InputObject <PsApiManagementApi>
   [-Name <String>]
   [-Description <String>]
   [-ServiceUrl <String>]
   [-Path <String>]
   [-Protocols <PsApiManagementSchema[]>]
   [-AuthorizationServerId <String>]
   [-AuthorizationScope <String>]
   [-OpenIdProviderId <String>]
   [-BearerTokenSendingMethod <String[]>]
   [-SubscriptionKeyHeaderName <String>]
   [-SubscriptionKeyQueryParamName <String>]
   [-SubscriptionRequired]
   [-PassThru]
   [-ApiType <PsApiManagementApiType>]
   [-TermsOfServiceUrl <String>]
   [-ContactName <String>]
   [-ContactUrl <String>]
   [-ContactEmail <String>]
   [-LicenseName <String>]
   [-LicenseUrl <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Set-AzApiManagementApi cmdlet modifies an Azure API Management API.

Examples

Example 1: Modify an API

$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Set-AzApiManagementApi -Context $ApiMgmtContext -Name "EchoApi" -ServiceUrl "https://contoso.com/apis/echo" -Protocols @('https') -Description "Responds with what was sent" -Path "echo"

Example 2: Add an API to an existing ApiVersionSet

$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
$versionSet = New-AzApiManagementApiVersionSet -Context $context -Name "Echo API Version Set" -Scheme Segment -Description "version set sample"
$api = Get-AzApiManagementApi -Context $ApiMgmtContext -ApiId "echo-api"
$api.ApiVersionSetId = $versionSet.Id
$api.ApiVersion = "v1"
$api.ApiVersionSetDescription = $versionSet.Description
Set-AzApiManagementApi -InputObject $api -PassThru

This example adds an API to an existing API Version Set

Example 3: Change the Backend ServiceUrl where the API is pointing to

$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
$updatedApiServiceUrl = "http://newechoapi.cloudapp.net/updateapi"
$updatedApi = Set-AzApiManagementApi -Context $ApiMgmtContext -ApiId $echoApiId -ServiceUrl $updatedApiServiceUrl

This example updates the ServiceUrl the echo-api is pointing to.

Parameters

-ApiId

Specifies the ID of the API to modify.

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

-ApiType

Type of API to create (http, soap, websocket, graphql). This parameter is optional.

Type:Nullable<T>[PsApiManagementApiType]
Accepted values:Http, Soap, WebSocket, GraphQL
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 identifier. 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

-BearerTokenSendingMethod

OpenId authorization server mechanism by which access token is passed to the API. Refer to https://datatracker.ietf.org/doc/html/rfc6749#section-4. This parameter is optional. Default value is $null.

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

-ContactEmail

The email address of the contact person/organization. MUST be in the format of an email address. This parameter is optional.

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

-ContactName

The identifying name of the contact person/organization. This parameter is optional.

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

-ContactUrl

The URL pointing to the contact information. MUST be in the format of a URL. This parameter is optional.

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:AzContext, 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

-InputObject

Instance of PsApiManagementApi. This parameter is required.

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

-LicenseName

The license name used for the API. This parameter is optional.

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

-LicenseUrl

A URL to the Terms of Service for the API. This parameter is optional.

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.

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

-OpenIdProviderId

OpenId authorization server identifier. This parameter is optional. Default value is $null. Must be specified if BearerTokenSendingMethods is specified.

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

-PassThru

passthru

Type:SwitchParameter
Position:Named
Default value:None
Required:False
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. 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:False
Accept pipeline input:True
Accept wildcard characters:False

-Protocols

Specifies an array of web API protocols. psdx_paramvalues http and https. These are the web protocols over which the API is made available. The default value is $Null.

Type:PsApiManagementSchema[]
Accepted values:Http, Https, Ws, Wss
Position:Named
Default value:None
Required:False
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:False
Accept pipeline input:True
Accept wildcard characters:False

-SubscriptionKeyHeaderName

Specifies the name of the subscription key header. 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 name of the subscription key query string parameter. The default value is $Null.

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

-SubscriptionRequired

Flag to enforce SubscriptionRequired for requests to the Api. This parameter is optional.

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

-TermsOfServiceUrl

A URL to the Terms of Service for the API. This parameter is optional.

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

Inputs

PsApiManagementContext

String

PsApiManagementApi

PsApiManagementSchema[]

SwitchParameter

Outputs

PsApiManagementApi