Close

Powershell script for APIManagementARMTemplateCreator fails

When using the APIManagementARMTemplateCreator, you run a Powershell script to actually generate the ARM templates. The Powershell script starts with the following command:
Install-Module -Name APIManagementTemplate -AllowClobber -Force

I used the Powershell script extensively before, but suddenly I ran into problems. My problems were very well explained in the following post:
https://dev.to/darksmile92/powershell-disabled-support-for-tls-1-0-for-the-gallery-update-module-and-install-module-broken-1oii

In short, Microsoft announced that the PowerShell Gallery has deprecated Transport Layer Security (TLS) versions 1.0 and 1.1 as of April 2020. This means you suddenly can’t run Install-Module anymore. Run the following command in Powershell ISE to fix the issue:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module PowerShellGet -RequiredVersion 2.2.4 -SkipPublisherCheck

Can be a real timesaver!