< Back

Get-AzureRmApiManagementPolicy

Tue Jan 29, 2019 9:29 pm

NAME Get-AzureRmApiManagementPolicy



SYNOPSIS

Gets the specified scope policy.





SYNTAX

Get-AzureRmApiManagementPolicy -ApiId <String> -Context <PsApiManagementContext> [-DefaultProfile <IAzureContextContainer>] [-Force] [-Format

<String>] [-SaveAs <String>] [-Confirm] [-WhatIf] [<CommonParameters>]



Get-AzureRmApiManagementPolicy -ApiId <String> -Context <PsApiManagementContext> [-DefaultProfile <IAzureContextContainer>] [-Force] [-Format

<String>] -OperationId <String> [-SaveAs <String>] [-Confirm] [-WhatIf] [<CommonParameters>]



Get-AzureRmApiManagementPolicy -Context <PsApiManagementContext> [-DefaultProfile <IAzureContextContainer>] [-Force] [-Format <String>] -ProductId

<String> [-SaveAs <String>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Get-AzureRmApiManagementPolicy cmdlet gets the specified scope policy.





PARAMETERS

-ApiId <String>

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



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Context <PsApiManagementContext>

Specifies an instance of PsApiManagementContext .



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

ps_force



Required? false

Position? named

Default value False

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Format <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-OperationId <String>

Specifies the identifier of the existing API operation. If you specify this parameter with ApiId the cmdlet returns operation-scope policy.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ProductId <String>

Specifies the identifier of an existing product. If you specify this parameter the cmdlet returns the product-scope policy.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SaveAs <String>

Specifies the file path to save the result to. If you do not specify this parameter the result is pipelined as a sting.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

String







NOTES









Example 1: Get the tenant level policy



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

PS C:\\>Get-AzureRmApiManagementPolicy -Context $apimContext -SaveAs "C:\\contoso\\policies\\tenantpolicy.xml"



This command gets tenant level policy and saves it to a file named tenantpolicy.xml.





Example 2: Get the product-scope policy



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

PS C:\\>Get-AzureRmApiManagementPolicy -Context $apimContext -ProductId "0123456789"



This command gets product-scope policy





Example 3: Get the API-scope policy



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

PS C:\\>Get-AzureRmApiManagementPolicy -Context $apimContext -ApiId "9876543210"



This command gets API-scope policy.





Example 4: Get the operation-scope policy



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

PS C:\\>Get-AzureRmApiManagementPolicy -Context $apimContext -ApiId "9876543210" -OperationId "777"



This command gets the operation-scope policy.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... mentpolicy

Remove-AzureRmApiManagementPolicy

Set-AzureRmApiManagementPolicy