Edit

Share via


New-AzWebAppSSLBinding

Creates an SSL certificate binding for an Azure Web App.

Syntax

S1

New-AzWebAppSSLBinding
    [-ResourceGroupName] <String>
    [-WebAppName] <String>
    [[-Slot] <String>]
    [-Name] <String>
    [[-SslState] <SslState>]
    [-CertificateFilePath] <String>
    [-CertificatePassword] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

S2

New-AzWebAppSSLBinding
    [-ResourceGroupName] <String>
    [-WebAppName] <String>
    [[-Slot] <String>]
    [-Name] <String>
    [[-SslState] <SslState>]
    [-Thumbprint] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

S3

New-AzWebAppSSLBinding
    [-WebApp] <PSSite>
    [-Name] <String>
    [[-SslState] <SslState>]
    [-CertificateFilePath] <String>
    [-CertificatePassword] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

S4

New-AzWebAppSSLBinding
    [-WebApp] <PSSite>
    [-Name] <String>
    [[-SslState] <SslState>]
    [-Thumbprint] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzWebAppSSLBinding cmdlet creates a Secure Socket Layer (SSL) certificate binding for an Azure Web App. The cmdlet creates an SSL binding in two ways:

  • You can bind a Web App to an existing certificate.
  • You can upload a new certificate and then bind the Web App to this new certificate. Regardless of which approach you use, the certificate and the Web App must be associated with the same Azure resource group. If you have a Web App in Resource Group A and you want to bind that Web App to a certificate in Resource Group B, the only way to do that is to upload a copy of the certificate to Resource Group A. If you upload a new certificate, keep in mind the following requirements for an Azure SSL certificate:
  • The certificate must contain a private key.
  • The certificate must use the Personal Information Exchange (PFX) format.
  • The certificate's subject name must match the domain used to access the Web App.
  • The certificate must use a minimum of 2048-bit encryption.

Examples

Example 1: Bind a certificate to a Web App

New-AzWebAppSSLBinding -ResourceGroupName "ContosoResourceGroup" -WebAppName "ContosoWebApp" -Thumbprint "E3A38EBA60CAA1C162785A2E1C44A15AD450199C3" -Name "www.contoso.com"

This command binds an existing Azure certificate (a certificate with the Thumbprint E3A38EBA60CAA1C162785A2E1C44A15AD450199C3) to the web app named ContosoWebApp.

Example 2

Creates an SSL certificate binding for an Azure Web App. (autogenerated)

New-AzWebAppSSLBinding -Name 'www.contoso.com' -ResourceGroupName 'ContosoResourceGroup' -SslState Disabled -Thumbprint 'E3A38EBA60CAA1C162785A2E1C44A15AD450199C3' -WebAppName 'ContosoWebApp'

powershell

Example 3

Creates an SSL certificate binding for an Azure Web App. (autogenerated)

New-AzWebAppSSLBinding -CertificateFilePath <String> -CertificatePassword <String> -Name 'www.contoso.com' -ResourceGroupName 'ContosoResourceGroup' -SslState Disabled -WebAppName 'ContosoWebApp'

Parameters

-CertificateFilePath

Specifies the file path for the certificate to be uploaded. The CertificateFilePath parameter is only required if the certificate has not yet been uploaded to Azure.

Parameter properties

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

Parameter sets

S1
Position:4
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
S3
Position:4
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CertificatePassword

Specifies the decryption password for the certificate.

Parameter properties

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

Parameter sets

S1
Position:5
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
S3
Position:5
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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

-Name

Specifies the name of the Web App.

Parameter properties

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

Parameter sets

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

-ResourceGroupName

Specifies the name of the resource group that the certificate is assigned to. You cannot use the ResourceGroupName parameter and the WebApp parameter in the same command.

Parameter properties

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

Parameter sets

S1
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
S2
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Slot

Specifies the name of the Web App deployment slot. You can use the Get-AzWebAppSlot cmdlet to get a slot. Deployment slots provide a way for you to stage and validate web apps without those apps being accessible over the Internet. Typically you will deploy your changes to a staging site, validate those changes, and then deploy to the production (Internet-accessible) site.

Parameter properties

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

Parameter sets

S1
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
S2
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SslState

Specifies whether the certificate is enabled. Set the SSLState parameter to 1 to enable the certificate, or set SSLState to 0 to disable the certificate.

Parameter properties

Type:

Nullable<T>[SslState]

Default value:None
Accepted values:Disabled, SniEnabled, IpBasedEnabled
Supports wildcards:False
DontShow:False

Parameter sets

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

-Thumbprint

Specifies the unique identifier for the certificate.

Parameter properties

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

Parameter sets

S2
Position:6
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
S4
Position:6
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WebApp

Specifies a Web App. To get a Web App, use the Get-AzWebApp cmdlet. You cannot use the WebApp parameter in the same command as the ResourceGroupName parameter and/or the WebAppName.

Parameter properties

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

Parameter sets

S3
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
S4
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WebAppName

Specifies the name of the Web App for which the new SSL binding is being created. You cannot use the WebAppName parameter and the WebApp parameter in the same command.

Parameter properties

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

Parameter sets

S1
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
S2
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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

PSSite

Outputs

HostNameSslState