Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. $myVars = '$(armDeploymentOutput)' | ConvertFrom-Json
  2. Write-Host "The following variables are available: $($myVars)" -Verbose
  3. $existingVaultName = $myVars.existingKeyVaultName.value
  4. $webappName=$myVars.webappName.value
  5. $webAppCustomHostname=$myVars.webAppCustomHostname.value
  6. $certName=$myVars.existingKeyVaultCertificateName.value
  7.  
  8. if ($webappName -and $webAppCustomHostname -and $existingVaultName -and $certName) {
  9. Write-Host "Attempting to enable SSL Binding for $($webappName) on the hostname $($webAppCustomHostname) using cert $($certName) from the existing keyvault of $($existingVaultName)." -Verbose
  10. Enable-SslStateOnWebapp -WebappName $webappName -customWebappHostname $webAppCustomHostname -existingKeyvaultName $existingVaultName -existingKeyvaultCertName $certName
  11. }
  12. else {
  13. 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
  14. }
  15.  
  16. function Enable-SslStateOnWebapp {
  17. param (
  18. [Parameter(
  19. Mandatory = $true,
  20. HelpMessage = 'A webapp name is required.')]
  21. [ValidateNotNullOrEmpty()]
  22. [string] $WebappName,
  23.  
  24. [PARAMETER(
  25. Mandatory = $true,
  26. HelpMessage = 'The FQDN of the custom hostname you want to bind.')]
  27. [ValidateNotNullOrEmpty()]
  28. [string] $customWebappHostname,
  29.  
  30. [Parameter(
  31. Mandatory = $true,
  32. HelpMessage = 'A name for an existing Keyvault is required.')]
  33. [ValidateNotNullOrEmpty()]
  34. [string] $existingKeyvaultName,
  35.  
  36. [PARAMETER(
  37. Mandatory = $true,
  38. HelpMessage = 'A name of the pfx certificate stored in the pre-existing keyvault')]
  39. [ValidateNotNullOrEmpty()]
  40. [string] $existingKeyVaultCertName
  41. )
  42. #getting webapp resources
  43. $webapp = Get-AzureRmResource -Name $webappName
  44. #obtaining resource group resources through the use of resource group name tied to webapp
  45. $rg = Get-AzureRmResource -ResourceGroupName $webapp.ResourceGroupName
  46.  
  47. ...
  48.  
  49. }
  50.  
  51. 2019-07-16T23:00:39.1496157Z ##[debug]Caught exception from task script.
  52. 2019-07-16T23:00:39.1536232Z ##[debug]Error record:
  53. 2019-07-16T23:00:39.1993172Z ##[debug]Enable-SslStateOnWebapp : Parameter set cannot be resolved using the specified named parameters.
  54. 2019-07-16T23:00:40.2927954Z ##[debug]At D:agent3_work_temp7be280f0-5905-4e05-99e0-972c90739a12.ps1:13 char:5
  55. 2019-07-16T23:00:40.2930113Z ##[debug]+ Enable-SslStateOnWebapp -WebappName $webappName -customWebappHost ...
  56. 2019-07-16T23:00:40.2940404Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  57. 2019-07-16T23:00:40.2940886Z ##[debug] + CategoryInfo : InvalidArgument: (:) [Enable-SslStateOnWebapp], ParameterBindingException
  58. 2019-07-16T23:00:40.2941287Z ##[debug] + FullyQualifiedErrorId : AmbiguousParameterSet,Enable-SslStateOnWebapp
  59. 2019-07-16T23:00:40.2941647Z ##[debug]
  60. 2019-07-16T23:00:40.2941968Z ##[debug]Script stack trace:
  61. 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