Set-​Azure​Rm​Api​Management​Policy

Sets the specified scope policy for API Management.

Syntax

Set-AzureRmApiManagementPolicy
   -ApiId <String>
   -Context <PsApiManagementContext>
   [-Format <String>]
   [-PassThru]
   [-Policy <String>]
   [-PolicyFilePath <String>]
   [<CommonParameters>]
Set-AzureRmApiManagementPolicy
   -ApiId <String>
   -Context <PsApiManagementContext>
   [-Format <String>]
   -OperationId <String>
   [-PassThru]
   [-Policy <String>]
   [-PolicyFilePath <String>]
   [<CommonParameters>]
Set-AzureRmApiManagementPolicy
   -Context <PsApiManagementContext>
   [-Format <String>]
   [-PassThru]
   [-Policy <String>]
   [-PolicyFilePath <String>]
   -ProductId <String>
   [<CommonParameters>]

Description

The Set-AzureRmApiManagementPolicy cmdlet sets the specified scope policy for API Management.

Examples

Example 1: Set the tenant level policy

PS C:\>Set-AzureRmApiManagementPolicy -Context $APImContext -PolicyFilePath "C:\contoso\policies\tenantpolicy.xml"

This command sets the tenant level policy from a file named tenantpolicy.xml.

Example 2: Set a product-scope policy

PS C:\>Set-AzureRmApiManagementPolicy -Context $APImContext -ProductId "0123456789" -Policy $PolicyString

This command sets the product-scope policy for API Management.

Example 3: Set API-scope policy

PS C:\>Get-AzureRmApiManagementPolicy -Context $APImContext -ApiId "9876543210" -Policy $PolicyString

This command sets API-scope policy for API Management.

Example 4: Set operation-scope policy

PS C:\>Set-AzureRmApiManagementPolicy -Context $APImContext -ApiId "9876543210" -OperationId "777" -Policy $PolicyString

This command sets operation-scope policy for API Management.

Required Parameters

-ApiId

Specifies the identifier of the existing API. If you specify this parameter, the cmdlet sets the API-scope policy.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Context

Specifies the instance of PsApiManagementContext.

Type:PsApiManagementContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-OperationId

Specifies the identifier of the existing operation. If specified with ApiId will set operation-scope policy. This parameters is required.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ProductId

Specifies the identifier of the existing product. If this parameter is specified, the cmdlet sets the product-scope policy.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Format

Specifies the format of the policy. The default value is "application/vnd.ms-azure-apim.policy+xml".

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PassThru

passthru

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Policy

Specifies the policy document as a string. This parameter is required if the -PolicyFilePath is not specified.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PolicyFilePath

Specifies the policy document file path. This parameter is required if the Policy parameter is not specified.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Outputs

bool