Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Websites/Websites.Test/ScenarioTests/SSLBindingTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ assign a custom domain to it and update global variable values.
#>

#Global variables
$rgname = "lketmtestantps10"
$appname = "lketmtestantps10"
$rgname = "RG-PS-UnitTesting"
$appname = "AppService-PS-UnitTesting"
$slot = "testslot"
$prodHostname = "www.adorenow.net"
$slotHostname = "testslot.adorenow.net"
$thumbprint = "6156D1475113476C55A3064D44DED9ECA0B33864"
$prodHostname = "www.psunittesting.com"
$slotHostname = "testslot.psunittesting.com"
$thumbprint = "210C5A1BBF7BC63F8733C3CB5E612FCFF3643E41"

<#
.SYNOPSIS
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Updated `New-AzWebAppSSLBinding` to support -WhatIf parameter

## Version 2.12.1
* Fixed `Import-AzWebAppKeyVaultCertificate` to use certificate naming convention same as portal [#19592]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
/// <summary>
/// this commandlet will let you create a new Azure Web app using ARM APIs
/// </summary>
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppSSLBinding"), OutputType(typeof(HostNameSslState))]
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppSSLBinding", SupportsShouldProcess = true), OutputType(typeof(HostNameSslState))]
public class NewAzureWebAppSSLBinding : WebAppBaseClientCmdLet
{
const string CertNamePostFixSeparator = "_";
Expand Down Expand Up @@ -130,7 +130,10 @@ protected override void ProcessRecord()

try
{
Certificate cert= WebsitesClient.CreateCertificate(resourceGroupName, certificateName, certificate);
if (this.ShouldProcess(this.WebAppName, string.Format("Creating a new certificate - '{0}' in Web Application - {1}.", certificateName, this.WebAppName)))
{
Certificate cert = WebsitesClient.CreateCertificate(resourceGroupName, certificateName, certificate);
}
}
catch (CloudException e)
{
Expand All @@ -149,8 +152,9 @@ protected override void ProcessRecord()
thumbPrint = Thumbprint;
break;
}

WriteObject(CmdletHelpers.GetHostNameSslStatesFromSiteResponse(
if (this.ShouldProcess(this.WebAppName, string.Format("Binding the certificate with thumbprint- '{0}' to Web Application - {1}.", thumbPrint, this.WebAppName)))
{
WriteObject(CmdletHelpers.GetHostNameSslStatesFromSiteResponse(
WebsitesClient.UpdateHostNameSslState(
resourceGroupName,
webAppName,
Expand All @@ -160,6 +164,7 @@ protected override void ProcessRecord()
SslState.HasValue ? SslState.Value : Management.WebSites.Models.SslState.SniEnabled,
thumbPrint),
Name));
}
}

private string GenerateCertName(string thumbPrint, string hostingEnv, string location, string resourceGroupName)
Expand Down
37 changes: 34 additions & 3 deletions src/Websites/Websites/help/New-AzWebAppSSLBinding.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ Creates an SSL certificate binding for an Azure Web App.
```
New-AzWebAppSSLBinding [-ResourceGroupName] <String> [-WebAppName] <String> [[-Slot] <String>] [-Name] <String>
[[-SslState] <SslState>] [-CertificateFilePath] <String> [-CertificatePassword] <String>
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

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

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

### S4
Expand Down Expand Up @@ -117,6 +117,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

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

Expand Down Expand Up @@ -246,6 +261,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```

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

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

Expand Down