New-AzureRmApiManagementCustomHostnameConfiguration

Creates an instance of PsApiManagementCustomHostNameConfiguration.

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

New-AzureRmApiManagementCustomHostnameConfiguration
   -Hostname <String>
   -HostnameType <PsApiManagementHostnameType>
   -HostNameCertificateInformation <PsApiManagementCertificateInformation>
   [-DefaultSslBinding]
   [-NegotiateClientCertificate]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzureRmApiManagementCustomHostnameConfiguration
   -Hostname <String>
   -HostnameType <PsApiManagementHostnameType>
   -PfxPath <String>
   [-PfxPassword <SecureString>]
   [-DefaultSslBinding]
   [-NegotiateClientCertificate]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzureRmApiManagementCustomHostnameConfiguration
   -Hostname <String>
   -HostnameType <PsApiManagementHostnameType>
   -KeyVaultId <String>
   [-DefaultSslBinding]
   [-NegotiateClientCertificate]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzureRmApiManagementCustomHostnameConfiguration cmdlet is a helper command that creates an instance of PsApiManagementCustomHostNameConfiguration. This command is used with the New-AzureRmApiManagement and Set-AzureRmApiManagement cmdlet.

Examples

Example 1: Create and initialize an instance of PsApiManagementCustomHostNameConfiguration using an Ssl Certificate from file

PS C:\>$portal = New-AzureRmApiManagementCustomHostnameConfiguration -Hostname "portal.contoso.com" -HostnameType Portal -PfxPath "C:\contoso\certificates\apimanagement.pfx" -PfxPassword "1111" -DefaultSslBinding
PS C:\>$customConfig = @($portal)
PS C:\>New-AzureRmApiManagement -ResourceGroupName "ContosoGroup" -Location "West US" -Name "ContosoApi" -Organization Contoso -AdminEmail admin@contoso.com -CustomHostnameConfiguration $customConfig

This command creates and initializes an instance of PsApiManagementCustomHostNameConfiguration for Portal. Then it creates a new ApiManagement service with custom hostname configuration.

Example 2: Create and initialize an instance of PsApiManagementCustomHostNameConfiguration using an Secret from KeyVault Resource

PS C:\>$portal = New-AzureRmApiManagementCustomHostnameConfiguration -Hostname "portal.contoso.com" -HostnameType Portal -KeyVaultId "https://apim-test-keyvault.vault.azure.net/secrets/api-portal-custom-ssl.pfx"

PS C:\>$customConfig = @($portal)
PS C:\>New-AzureRmApiManagement -ResourceGroupName "ContosoGroup" -Location "West US" -Name "ContosoApi" -Organization Contoso -AdminEmail admin@contoso.com -CustomHostnameConfiguration $customConfig -AssignIdentity

This command creates and initializes an instance of PsApiManagementCustomHostNameConfiguration.

Parameters

-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

-DefaultSslBinding

Determines whether the value is a secret and should be encrypted or not. This parameter is optional. Default Value is false.

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

-Hostname

Custom Hostname

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

-HostNameCertificateInformation

Existing Certificate Configuration.

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

-HostnameType

Hostname Type

Type:PsApiManagementHostnameType
Accepted values:Proxy, Portal, Management, Scm
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-KeyVaultId

KeyVaultId to the secret storing the Custom SSL Certificate.

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

-NegotiateClientCertificate

Determines whether the value is a secret and should be encrypted or not. This parameter is optional. Default Value is false.

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

-PfxPassword

Password for the .pfx certificate file.

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

-PfxPath

Path to a .pfx certificate file.

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

Inputs

PsApiManagementCertificateInformation

Outputs

PsApiManagementCustomHostNameConfiguration