I have a pre-deployment script for an Azure deployment written with the Az module. I removed AzureRm and installed the Az module at the OS level, and have also set the OctopusUseBundledAzureModules project variable to False.
I’m now receiving the following error, which is likely due to AzureRM being called. I did see in reading the forum that the Disable-AzureRMContextAutosave call was added fairly recently to address another problem. Is there any way to disable that call, or call the Az version of it instead?
Disable-AzureRMContextAutosave : The term ‘Disable-AzureRMContextAutosave’ 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.
Thanks for getting in touch!
At this stage Octopus still requires AzureRM as we call AzureRM for a variety of Azure tasks. It is definitely on our backlog to remove this requirement, unfortunately it is one task among many at this point in time.
Sorry I don’t have better news at this stage,
@Alex.Rolley : I also tried similar stuff, can you please let me know if there is a way to run Az command right now in octopus. I tried below steps-
I logged in the server in which Octopus master is installed and executed -Enable-AzureRmAlias
Set variable OctopusUseBundledAzureModules to FALSE
Uninstalled AzureRm on Octopus server
The term ‘Disable-AzureRMContextAutosave’ is not recognized as the name of a cmdlet, function, script file
Now I logged in octopus server and run Disable-AzureRMContextAutosave and it gives no error.
Thanks for getting in touch.
You are on the right track with
Enable-AzureRMAlias, what I’ve found is that you will need to define a scope for the command otherwise it is restricted to the powershell session you are currently in (which is why it works for you and not in Octopus).
So the command that has worked in testing (although it’s not officially supported by Octopus) is
PS C:\> Enable-AzureRmAlias -Scope LocalMachine
If you have already uninstalled
AZ and set
OctopusUseBundledAzureModules to FALSE this should allow you to use the
AZ powershell module with Octopus.
Any questions please let me know,