azure-pipelines-tasks: [BUG]: "##[warning]You're using AzureRM which will be retired soon, please schedule an update." in AzurePowerShell@5
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
No response
Task version
No response
Issue Description
Every time I run any AzurePowerShell@5 step, I get the following in the Pipeline output:
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows Server 2022
Relevant log output
Starting: Setup Azure AD App for SupportUsers
==============================================================================
Task : Azure PowerShell
Description : Run a PowerShell script within an Azure environment
Version : 5.239.5
Author : Microsoft Corporation
Help : https://aka.ms/azurepowershelltroubleshooting
==============================================================================
Generating script.
========================== Starting Command Output ===========================
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\a\_temp\ac342356-0e48-44e1-8df4-84abbf833bb7.ps1'"
Added TLS 1.2 in session.
Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\Az.Accounts\2.17.0\Az.Accounts.psd1 -Global
##[warning]You're using AzureRM which will be retired soon, please schedule an update.
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
Full task logs with system.debug enabled
No response
Repro steps
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 22
- Comments: 29 (2 by maintainers)
Thank you for raising this issue, right now our team is working on switching from AzureRM (which no longer supported from 29/02/2024) to Az.
Since we can’t check user’s PowerShell scripts, we are displaying such warning to notify users to double check if their scripts are also using deprecated AzureRM, it will disappear after rollout of this migration is completed.
Also, if you’d like to help our team and switch to the new Az you can add environment variable
RETIRE_AZURERM_POWERSHELL_MODULEand set it totrue. (This will also dismiss this warning)If this is the purpose of the warning, then the language used in the message is very misleading.
This actually started breaking our builds and PRs, because we use the Build Quality Checks extension to ensure no warnings are introduced by code changes. We do not use AzureRM (our scripts explicitly load recent versions of Az modules).
Do you have an estimate of when this roll out will be completed?
Exactly, then it should say “IF you are using […]”. And there should be a way to turn off the warning without actually running uninstall scripts and whatnot.
I’ve just tried this on a classic release pipeline and it does suppress the warning. My problem with this though is that when this is no longer an issue (whenever that may be), our pipelines will be littered with the environment variable which will no longer have a meaning.
Looking at the code of VstsAzureHelpers, it seems that when
RETIRE_AZURERM_POWERSHELL_MODULEis set the agent will actively try to install some Az modules and uninstall AzureRM modules from the machine. This is unacceptable in my environment, because the build server configuration (including the installed PowerShell modules) is controlled via other means and the agent should not change it (especially not as part of running a pipeline).That option does not work for classical releases. I got an official answer from Microsoft through other channels that they do not have a timeline for fixing this. It seems that it is acceptable to have bugs in production… what can I say?
@kirill-ivlev I saw that the deprecation of AzureRM was already committed as version
5.242.*. We’re using version5.246.1and we’re getting the warning about AzureRM.If I understand correctly, we need to set
env:RETIRE_AZURERM_POWERSHELL_MODULE:truein our YAML to get rid of the warning (I haven’t tried it yet). Is there a plan to retire AzureRM from the AzurePowerlShell task without the requirement to set this flag? If so, when?Very odd to get warnings in our pipelines that have no real cause. This impacts how the pipelines need to be configured with respect to when to continue.
Why display a warning , without a check if AzureRM modules are used in the scripts or installed at all?
@kirill-ivlev do you mean something like this, the last line?
It’s one of the flags you can set on the inputs of the activity. See last line of first example here:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-powershell-v5?view=azure-pipelines#examples