Coder Social home page Coder Social logo

[BUG]: "##[warning]You're using AzureRM which will be retired soon, please schedule an update." in AzurePowerShell@5 about azure-pipelines-tasks HOT 18 OPEN

shurick81 avatar shurick81 commented on May 29, 2024 12
[BUG]: "##[warning]You're using AzureRM which will be retired soon, please schedule an update." in AzurePowerShell@5

from azure-pipelines-tasks.

Comments (18)

kirill-ivlev avatar kirill-ivlev commented on May 29, 2024 5

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_MODULE and set it to true. (This will also dismiss this warning)

from azure-pipelines-tasks.

jberezanski-mdg avatar jberezanski-mdg commented on May 29, 2024 3

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).

from azure-pipelines-tasks.

dafad-dew avatar dafad-dew commented on May 29, 2024 1

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

from azure-pipelines-tasks.

xcITs-Xian avatar xcITs-Xian commented on May 29, 2024

We have exactly the same issue!

In our DevOps pipeline (classic), we use an "Azure PowerShell 5.*" task that uses a service principal.
Every time this task runs, we get a warning that we are using "AzureRM".
The whole script isn't using any Azure RM commands.
Last week, this warning started to appear.

image

from azure-pipelines-tasks.

taylorhutchison avatar taylorhutchison commented on May 29, 2024

Same problem. We are getting this warning but have absolutely no AzureRM that we can tell. Is it the task itself that is using AzureRM?

from azure-pipelines-tasks.

AshishDadhich4h2 avatar AshishDadhich4h2 commented on May 29, 2024

Sounds like a bug in PowerShell task itself. Couldn't find any release notes related to task: AzurePowerShell@5
According to this https://techcommunity.microsoft.com/t5/azure-tools-blog/azurerm-will-retire-by-29-february-2024/ba-p/2156169 , warning makes sense but there is no recent comment on that task link : https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-powershell-v5?view=azure-pipelines

from azure-pipelines-tasks.

jsandquist avatar jsandquist commented on May 29, 2024

I found that the tasks themselves were last updated two weeks ago to migrate from AzureRM to Az powerShell, e.g.

to list two of the Pull Requests. I assume this is the reason somehow - but haven't looked into it more than this.

from azure-pipelines-tasks.

n-athan avatar n-athan commented on May 29, 2024

Microsoft has an option to use compatability mode with Enable-AzureRMAlias. I tried this as the first line of the inline Powershell within the AzurePowershell@5 tasks, but we still get the warning that we use the AzureRM module.
We do not use the AzureRM cmdlets in our Powershell scripts.

from azure-pipelines-tasks.

dafad-dew avatar dafad-dew commented on May 29, 2024

Also had this one suddenly appear.
Switching it to use Powershell Core using:
pwsh: true
gets it working with no warnings.

from azure-pipelines-tasks.

PKRekha avatar PKRekha commented on May 29, 2024

Also had this one suddenly appear. Switching it to use Powershell Core using: pwsh: true gets it working with no warnings.

Can you please provide me with more info on this, like an example of yours. I am also facing the same issue with ps5.*

from azure-pipelines-tasks.

PKRekha avatar PKRekha commented on May 29, 2024

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

Thank you, it helps. But my pipeline is classic one, so I think we will have to find how to set that value?

from azure-pipelines-tasks.

PKRekha avatar PKRekha commented on May 29, 2024

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

got it now, I can see in advanced, Use Powershell Core check box, I will try to check that one and see if the warning goes.
I will update after I do it.
Thank you

from azure-pipelines-tasks.

damu9618 avatar damu9618 commented on May 29, 2024

Hi , I have configured my task as below
- task: AzurePowerShell@5
displayName: 'Display installed modules'
inputs:
azureSubscription:.azureServiceConnection
scriptType: inlineScript
inline: |
$VerbosePreference = "Continue"
# Enable AzureRM alias support
Enable-AzureRmAlias
Write-Host "All modules:"
Get-InstalledModule
azurePowerShellVersion: LatestVersion
pwsh: true
errorActionPreference: 'stop'
continueOnError: true
enabled: true
I have used advanced options as pwsh: true, However I could still see warning from my pipeline below
Added TLS 1.2 in session.
Import-Module -Name C:\Modules\az_11.3.1\Az.Accounts\2.17.0\Az.Accounts.psd1 -Global
##[warning]You're using AzureRM which will be retired soon, please schedule an update.

from azure-pipelines-tasks.

shurick81 avatar shurick81 commented on May 29, 2024

@kirill-ivlev do you mean something like this, the last line?

    - task: AzurePowerShell@5
      displayName: 'Transform Configs and Deployment files'
      inputs:
        azureSubscription: $(PO_AzureCustSubscription)
        ScriptType: 'FilePath'
        ScriptPath: '$(System.DefaultWorkingDirectory)/Scripts/PS/cust-transform.ps1'
        errorActionPreference: 'continue'
        azurePowerShellVersion: 'LatestVersion'
      env:
        APPLICATION_INSIGHTS_CONNECTION_STRING: $(APPLICATION_INSIGHTS_CONNECTION_STRING)
        RETIRE_AZURERM_POWERSHELL_MODULE: true

from azure-pipelines-tasks.

nubgamerz avatar nubgamerz commented on May 29, 2024

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_MODULE and set it to true. (This will also dismiss this warning)

You mentioned about this variable helping your team... does that mean by using this env var, it will provide your team access to our powershell scripts? Just want to confirm due to legal requirements.

from azure-pipelines-tasks.

kirill-ivlev avatar kirill-ivlev commented on May 29, 2024

@shurick81 yes, right

from azure-pipelines-tasks.

jberezanski-mdg avatar jberezanski-mdg commented on May 29, 2024

Looking at the code of VstsAzureHelpers, it seems that when RETIRE_AZURERM_POWERSHELL_MODULE is 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).

from azure-pipelines-tasks.

m-mrks avatar m-mrks commented on May 29, 2024

Is there an option to only suppress the warning?

We've completed migration from AzureRM to Az; no AzureRM-modules are installed.

When we set RETIRE_AZURERM_POWERSHELL_MODULE=true, and run an AzurePowerShell@5-task (v5.239.9), the "You're using AzureRM which will be retired soon, please schedule an update."-messages is gone.

However, Uninstall-AzureRM is called on every execution.

==============================================================================
Task         : Azure PowerShell
Description  : Run a PowerShell script within an Azure environment
Version      : 5.239.9
Author       : Microsoft Corporation
Help         : https://aka.ms/azurepowershelltroubleshooting
==============================================================================
Generating script.
========================== Starting Command Output ===========================
"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agents\Agent1\_work\_temp\8dd805fe-5887-4937-8423-4e36fc4152ce.ps1'"
Added TLS 1.2 in session.
Import-Module -Name C:\Users\<...>\Documents\PowerShell\Modules\Az.Accounts\2.12.1\Az.Accounts.psd1 -Global -PassThru -Force
Imported module 'Az.Accounts', version: 2.12.1
Update-AzConfig -DisplayBreakingChangeWarning False -AppliesTo Az
Enable-AzureRmAlias -Scope Process
Import-Module -Name C:\Users\<...>\Documents\PowerShell\Modules\Az.Resources\6.6.0\Az.Resources.psd1 -Global -PassThru -Force
Imported module 'Az.Resources', version: 6.6.0
Import-Module -Name C:\Program Files\PowerShell\Modules\Az.Storage\4.5.0\Az.Storage.psd1 -Global -PassThru -Force
Imported module 'Az.Storage', version: 4.5.0
Uninstall-AzureRm
WARNING: Running this cmdlet in PowerShell Core will only remove the modules from PowerShell Core. Please rerun this cmdlet in a PowerShell 5.1 session to remove the modules from PowerShell 5.1.
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
Clear-AzContext -Scope Process
Clear-AzConfig -DefaultSubscriptionForLogin
Connect-AzAccount

from azure-pipelines-tasks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.