Thanks for getting in touch! Running this scrip manually can be a pain, but overall not too much of a problem. There are a couple of things you will need to explicitly define, which Octopus would otherwise do for you in the step template.
You should be able to manage it by manually installing the Azure PowerShell module on your target (
install-module Azure). Next you will need to specify a few project variables which will be used for your Azure connection. You will need the following:
ApplicationID: To get the Application ID, login to the Azure portal, select Azure Active Directory > App Registrations > Select the service principal and copy the Application ID
TenantID: The TenantID can be found by running
get-AzureRmSubscription while logged into Azure PowerShell.
ApplicationApiKey: This is the API key for your service principal account.
Once you have the above as project variables, you can create a script step with the following:
$secpasswd = ConvertTo-SecureString $ApplicationApiKey -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ($ApplicationId, $secpasswd)
Login-AzureRmAccount -Credential $mycreds -ServicePrincipal -TenantId $tenantid
This should be enough to get your custom template running.
Please let me know if you have any questions, or if this gives you and problems.