0

Trying to run our terraform script in a azure devops pipeline. It invokes a powershell script that uses azure cli to create a resource that is not natively available in terraform. However, we run into error that Az and AzureRm modules cannot both be installed.


2019-06-07T15:45:48.1553235Z same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can

2019-06-07T15:45:48.1554405Z use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure 

2019-06-07T15:45:48.1555064Z Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found 

2019-06-07T15:45:48.1555474Z here: https://aka.ms/azps-migration-guide

Tried running Uninstall-AzureRm but the command is not found.

How do you remove azurerm from VS 2017 Hosted agent instance?

4

1 Answer 1

1

It appears that you are using the PowerShell commandlets instead of the Azure CLI. I would suggest you switch back to using AzureRm in your PowerShell commands instead of Az. Then just make sure that you set the "Enable-AzureRmAlias" if you are using the new Az module locally. This will ensure that you can run the same script in both locations. It isn't perfect, but should get you over the hump.

If you don't mind using preview stuff, if you switch all your PowerShell tasks to use version 4, then you should be able to use the Az versions straight up.

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.