Set-AzureRmApiManagementHostnames

Sets a custom hostname configuration for an API Management service proxy or portal.

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

Set-AzureRmApiManagementHostnames
   -ResourceGroupName <String>
   -Name <String>
   [-PortalHostnameConfiguration <PsApiManagementHostnameConfiguration>]
   [-ProxyHostnameConfiguration <PsApiManagementHostnameConfiguration>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Set-AzureRmApiManagementHostnames
   -ApiManagement <PsApiManagement>
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Set-AzureRmApiManagementHostnames cmdlet applies a custom hostname configuration for an API Management service proxy or portal.

Examples

Example 1: Set the custom hostname configuration for a proxy and portal

PS C:\>Set-AzureRmApiManagementHostnames -Name ContosoApi -ResourceGroupName Contoso -PortalHostnameConfiguration $portalHostnameConf -ProxyHostnameConfiguration $proxyHostnameConf

This command sets the custom hostname configuration for proxy and portal.

Example 2: Configure a custom hostname for a proxy and portal

PS C:\>Import-AzureRmApiManagementHostnameCertificate -Name ContosoApi -ResourceGroupName "Contoso" -HostnameType "Proxy" -PfxPath "C:\proxycert.pfx" -PfxPassword "CertSecret"
PS C:\> Import-AzureRmApiManagementHostnameCertificate -Name "ContosoApi" -ResourceGroupName "Contoso" -HostnameType "Portal" -PfxPath "C:\portalcert.pfx" -PfxPassword "CertSecret"
PS C:\> $PortalHostnameConf = New-AzureRmApiManagementHostnameConfiguration -Hostname "portal.contoso.com" -CertificateThumbprint "33CC47C6FCA848DC9B14A6F071C1EF7C"
PS C:\> $ProxyHostnameConf = New-AzureRmApiManagementHostnameConfiguration -Hostname "proxy.contoso.com" -CertificateThumbprint "5DD7CCF6A1E74E0987DD2873406B7264"
PS C:\> Set-AzureRmApiManagementHostnames -Name "ContosoApi" -ResourceGroupName "Contoso" -PortalHostnameConfiguration $PortalHostnameConf -ProxyHostnameConfiguration $ProxyHostnameConf

This example configures a custom hostname for proxy and portal. You need to import corresponding certificates and then apply the custom hostnames.

Parameters

-ApiManagement

Specifies the PsApiManagement instance that this cmdlet gets the PortalHostnameConfiguration and ProxyHostnameConfiguration parameters from.

Type:PsApiManagement
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

-Name

Specifies the name of the API Management instance.

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

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

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

-PortalHostnameConfiguration

Specifies the custom portal hostname configuration. Passing $null to the cmdlet sets the default hostname.

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

-ProxyHostnameConfiguration

Specifies the custom proxy hostname configuration. Passing $null sets the default hostname.

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

-ResourceGroupName

Specifies the name of the resource group under which the API Management instance exists.

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

Inputs

PsApiManagement

Parameters: ApiManagement (ByValue)

String

PsApiManagementHostnameConfiguration

Outputs

PsApiManagement