Edit

Share via


New-AzApiManagementCertificate

Creates an API Management certificate to be used during Authentication with Backend.

Syntax

LoadFromFile (Default)

New-AzApiManagementCertificate
    -Context <PsApiManagementContext>
    [-CertificateId <String>]
    [-PfxFilePath <String>]
    [-PfxPassword <String>]
    [-KeyVault <PsApiManagementKeyVaultEntity>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Raw

New-AzApiManagementCertificate
    -Context <PsApiManagementContext>
    [-CertificateId <String>]
    [-PfxBytes <Byte[]>]
    [-PfxPassword <String>]
    [-KeyVault <PsApiManagementKeyVaultEntity>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The New-AzApiManagementCertificate cmdlet creates an Azure API Management certificate.

Examples

Example 1: Create and upload a certificate

$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
New-AzApiManagementCertificate -Context $ApiMgmtContext -PfxFilePath "C:\contoso\certificates\apimanagement.pfx" -PfxPassword "1111"

This command uploads a certificate to Api Management. This certificate can be used for mutual authentication with backend using policies.

Example 2

Creates an API Management certificate to be used during Authentication with Backend. (autogenerated)

New-AzApiManagementCertificate -CertificateId '0123456789' -Context <PsApiManagementContext> -PfxFilePath 'C:\contoso\certificates\apimanagement.pfx' -PfxPassword '1111'

Example 3 : Create a keyVault Certificate

$secretIdentifier = 'https://contoso.vault.azure.net/secrets/xxxx'
$keyvault = New-AzApiManagementKeyVaultObject -SecretIdentifier $secretIdentifier
$keyVaultcert = New-AzApiManagementCertificate -Context $context -CertificateId $kvcertId -KeyVault $keyvault

The first command creates a keyvault. The second command creates a certificate using secret from this keyvault.

Parameters

-CertificateId

Specifies the ID of the certificate to create. If you do not specify this parameter, an ID is generated for you.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Context

Specifies a PsApiManagementContext object.

Parameter properties

Type:PsApiManagementContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyVault

KeyVault used to fetch certificate data.This parameter is required if -PfxFilePath not specified. See New-AzApiManagementKeyVaultObject for details.

Parameter properties

Type:PsApiManagementKeyVaultEntity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PfxBytes

Specifies an array of bytes of the certificate file in .pfx format. This parameter is required if you do not specify the PfxFilePath parameter.

Parameter properties

Type:

Byte[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Raw
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PfxFilePath

Specifies the path to the certificate file in .pfx format to create and upload. This parameter is required if you do not specify the PfxBytes parameter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

LoadFromFile
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PfxPassword

Specifies the password for the certificate.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PsApiManagementContext

String

Byte

Outputs

PsApiManagementCertificate