Error deploying Azure App Service when Powershell Core enabled

We are seeing an error when deploying to an azure app service, when using Powershell Core (for pre-deployment scripts).

I need to use Powershell Core as there is new commands + parameters I need for my pre-deployment script.

On our server, we installed Powershell Core 6.

Octo Deploy version: 2019.12.4

Attempt 1 of 5 failed: The term 'Enable-AzureRmAlias' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
Waiting for 5 seconds before retrying... 
Retrying... 
Attempt 2 of 5 failed: The term 'Enable-AzureRmAlias' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
Waiting for 5 seconds before retrying... 
Retrying... 
Attempt 3 of 5 failed: The term 'Enable-AzureRmAlias' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
Waiting for 5 seconds before retrying... 
Retrying... 
Attempt 4 of 5 failed: The term 'Enable-AzureRmAlias' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
Waiting for 5 seconds before retrying... 
Retrying... 
ObjectNotFound: The term 'Enable-AzureRmAlias' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
At C:\Octopus\Work\20200226012621-56674-532\staging\Octopus.AzureContext.ps1:74 char:17 
+                 Enable-AzureRmAlias -Scope Process 
+                 ~~~~~~~~~~~~~~~~~~~ 
at <ScriptBlock>, C:\Octopus\Work\20200226012621-56674-532\staging\Octopus.AzureContext.ps1: line 74 

I tried the to install the Powershell Azure modules Az into the Powershell Core process and told Octo to use the non-bundled modules.

image

If I run the Enable-AzureRmAlias on the server, it all works correctly.

Ah, it seems that it’s not picking up the Az module. I needed to install it for AllUsers so it put the module in $env:ProgramFiles\PowerShell\Modules