Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $myVars = '$(armDeploymentOutput)' | ConvertFrom-Json
- Write-Host "The following variables are available: $($myVars)" -Verbose
- $existingVaultName = $myVars.existingKeyVaultName.value
- $webappName=$myVars.webappName.value
- $webAppCustomHostname=$myVars.webAppCustomHostname.value
- $certName=$myVars.existingKeyVaultCertificateName.value
- if ($webappName -and $webAppCustomHostname -and $existingVaultName -and $certName) {
- Write-Host "Attempting to enable SSL Binding for $($webappName) on the hostname $($webAppCustomHostname) using cert $($certName) from the existing keyvault of $($existingVaultName)." -Verbose
- Enable-SslStateOnWebapp -WebappName $webappName -customWebappHostname $webAppCustomHostname -existingKeyvaultName $existingVaultName -existingKeyvaultCertName $certName
- }
- else {
- Write-Host "Insufficient parameters have been provided to complete SSL Binding. To enable SSL binding, please provide a custom hostname, an existing keyvault where your certificate is stored, and the name of your certificate. Please visit the readme for more information." -Verbose
- }
- function Enable-SslStateOnWebapp {
- param (
- [Parameter(
- Mandatory = $true,
- HelpMessage = 'A webapp name is required.')]
- [ValidateNotNullOrEmpty()]
- [string] $WebappName,
- [PARAMETER(
- Mandatory = $true,
- HelpMessage = 'The FQDN of the custom hostname you want to bind.')]
- [ValidateNotNullOrEmpty()]
- [string] $customWebappHostname,
- [Parameter(
- Mandatory = $true,
- HelpMessage = 'A name for an existing Keyvault is required.')]
- [ValidateNotNullOrEmpty()]
- [string] $existingKeyvaultName,
- [PARAMETER(
- Mandatory = $true,
- HelpMessage = 'A name of the pfx certificate stored in the pre-existing keyvault')]
- [ValidateNotNullOrEmpty()]
- [string] $existingKeyVaultCertName
- )
- #getting webapp resources
- $webapp = Get-AzureRmResource -Name $webappName
- #obtaining resource group resources through the use of resource group name tied to webapp
- $rg = Get-AzureRmResource -ResourceGroupName $webapp.ResourceGroupName
- ...
- }
- 2019-07-16T23:00:39.1496157Z ##[debug]Caught exception from task script.
- 2019-07-16T23:00:39.1536232Z ##[debug]Error record:
- 2019-07-16T23:00:39.1993172Z ##[debug]Enable-SslStateOnWebapp : Parameter set cannot be resolved using the specified named parameters.
- 2019-07-16T23:00:40.2927954Z ##[debug]At D:agent3_work_temp7be280f0-5905-4e05-99e0-972c90739a12.ps1:13 char:5
- 2019-07-16T23:00:40.2930113Z ##[debug]+ Enable-SslStateOnWebapp -WebappName $webappName -customWebappHost ...
- 2019-07-16T23:00:40.2940404Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 2019-07-16T23:00:40.2940886Z ##[debug] + CategoryInfo : InvalidArgument: (:) [Enable-SslStateOnWebapp], ParameterBindingException
- 2019-07-16T23:00:40.2941287Z ##[debug] + FullyQualifiedErrorId : AmbiguousParameterSet,Enable-SslStateOnWebapp
- 2019-07-16T23:00:40.2941647Z ##[debug]
- 2019-07-16T23:00:40.2941968Z ##[debug]Script stack trace:
- 2019-07-16T23:00:40.2942368Z ##[debug]at Enable-SslStateOnWebapp, D:agent3_workr6a_infra-grs-referenceappdroppwsh-modulesgrs-armenable-ssl_state_on_webappenable-ssl_state_on_webapp.ps1: line 64
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement