1

Ahead of the deprecation of the AzureRM powershell cmdlets later this year I am updating some of our infrastructure scripts to use the Az powershell cmdlets rather than AzureRM.

One of our scripts uploads SSL certificates to Azure Cloud Service(Classic) resources using Add-AzureCertificate:

Add-AzCertificate -ServiceName $serviceName -CertToDeploy $certObject

where $certObject is a X509Certificate2 object.

What is the equivalent cmdlet in the Az module? Add-AzCertificate does not exist.

On the Cloud Service documentation page where it details configuring SSL, only certificate upload via the Azure portal is shown.

rcbevans
  • 7,101
  • 4
  • 30
  • 46
  • Try running `Get-Command -Name Add-Az*Certificate -Module Az.*` in Powershell and see what modules are available? – RoadRunner Mar 14 '20 at 06:03
  • Also is this for SSL binding for a Azure web app? If so you could use `New-AzWebAppSSLBinding`, which can take a `.pfx` certificate as input. I found this with `Get-Command -Name *SSL* -Module Az.*`. – RoadRunner Mar 14 '20 at 06:14
  • @RoadRunner This is about Azure Cloud Services which I don't believe is supported in the new Azure Powershell Cmdlets (which is a shame considering there are so many organizations that still use Cloud Services). – Gaurav Mantri Mar 14 '20 at 07:17
  • 1
    Long shot idea: call `Enable-AzureRmAlias` and try calling the old Cmdlet - if it works without the "old" powershell modules, you know that it should exist – Alex AIT Mar 14 '20 at 08:24
  • Unfortunately, after `Enable-AzureRmAlias`, `Add-AzureCertificate` appears to be broken , throwing a `System.PlatformNotSupportedException`: ComputeManagementClient requires a WebRequestHandler in its HTTP pipeline to work with client certificates. I have been unable to find any information on this error or how to get things working. – rcbevans Mar 17 '20 at 18:35

1 Answers1

0

As the comment from @Alex AIT, before call the AzureRM commands, you can run Enable-AzureRmAlias cmdlet which enables a compatibility mode through aliases, to allow you to use existing scripts with minimal modification while working towards a full migration to Az. For more information, you could refer to Migrate existing scripts to Az.

Also, to call Azure Cloud Service(Classic) resources, you still need Azure modules. View this example- Az / AzureRM / Legacy Azure Powershell Conflicts.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • Thanks for the suggestions; unfortunately this still appears to be broken. `Add-AzureCertificate` throws a `System.PlatformNotSupportedException`: ComputeManagementClient requires a WebRequestHandler in its HTTP pipeline to work with client certificates. I have so far been unable to find any information on this error or how to get things working. – rcbevans Mar 17 '20 at 18:37
  • not sure, Could you try the 3 examples [here](https://github.com/MicrosoftDocs/azure-docs-powershell/blob/master/azuresmps-4.0.0/Azure/Add-AzureCertificate.md#example-3-upload-a-certificate-object)? Are there the same error? Or have a try with `New-AzureRmWebAppSSLBinding` https://stackoverflow.com/questions/23066463/how-to-add-an-ssl-certificate-to-an-azure-website-using-powershell – Nancy Mar 18 '20 at 07:56