Get-AzureRmApiManagementPolicy
Gets the specified scope policy.
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
Get-AzureRmApiManagementPolicy
-Context <PsApiManagementContext>
[-Format <String>]
[-SaveAs <String>]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Get-AzureRmApiManagementPolicy
-Context <PsApiManagementContext>
[-Format <String>]
[-SaveAs <String>]
-ProductId <String>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Get-AzureRmApiManagementPolicy
-Context <PsApiManagementContext>
[-Format <String>]
[-SaveAs <String>]
-ApiId <String>
[-ApiRevision <String>]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Get-AzureRmApiManagementPolicy
-Context <PsApiManagementContext>
[-Format <String>]
[-SaveAs <String>]
-ApiId <String>
[-ApiRevision <String>]
-OperationId <String>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Get-AzureRmApiManagementPolicy cmdlet gets the specified scope policy.
Examples
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.
Parameters
-ApiId
Specifies the identifier of the existing API. If you specify this parameter the cmdlet returns the API-scope policy.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ApiRevision
Identifier of API Revision. This parameter is optional. If not specified, the policy will be retrieved from the currently active api revision.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Context
Specifies an instance of PsApiManagementContext.
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 |
-Force
ps_force
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Format
Specifies the format of the API management policy. The default value for this parameter is "application/vnd.ms-azure-apim.policy+xml".
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-OperationId
Specifies the identifier of the existing API operation. If you specify this parameter with ApiId the cmdlet returns operation-scope policy.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ProductId
Specifies the identifier of an existing product. If you specify this parameter the cmdlet returns the product-scope policy.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SaveAs
Specifies the file path to save the result to. If you do not specify this parameter the result is pipelined as a sting.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |