I am using Azure Dev Ops build agents to do all my CI/CD. I am having trouble installing Az Powershell Module version 2.8.0 on the build agent. I need that particular version because a lot of new APIs have been released on that version when compared to 2.6.0. Installing 2.8.0 on the build agent before running my build process results in failure. As you can see here 2.8.0 is not yet installed on the base images for these agents. If anyone has some tips on how I can consume this specific module that would be really helpful. In the mean time I have opened an issue to add the version
Use below script in Powershell task to install Az 2.8.0 into Hosted linux agent:
Install-Module -Name Az -RequiredVersion 2.8.0 -Force -AllowClobber
Get-InstalledModule #Just print out the details to confirm whether `Az 2.8.0` has been installed successfully
You can see Az 2.8.0 has been installed into hosted agent successfully.
Just one thing you should pay attention to, after the pipeline finished, our server will recycle the image of the currently used host agent. And the system will obtain a brand new agent image when you re-run the pipeline. So, this powershell task must be executed in every pipeline to let the environment satisfied your requirements.
Related
I have a release Pipeline in which I use Azure PowerShell to deploy artifacts into AppServices in Azure.
It was working fine around two weeks ago but now failing.
I stayed nights troubleshooting and searching around for solution, but no success :(
In the Preferred Azure Powershell Version I have this tip: "
In case of hosted agents, the supported Azure PowerShell Version is:
1.0.0, 1.6.0, 2.3.2, 2.6.0, 3.1.0 (Hosted VS2017 Queue). To pick the latest version available on the agent, select "Latest installed
version".
"
I installed Az version 3.1.0 with the below command from normal Powershell using Pipeline on the target agent:
Install-Module -Name Az -Scope CurrentUser -RequiredVersion 3.1.0 -AllowClobber -Repository PSGallery -Force -SkipPublisherCheck
I can see Az module 3.1.0 installed successfully when I run Get-InstalledModule.
I tried both Tasks version 4 and 5 that supports Az and tried different versions from supported versions and all are failing with the error "Az.Accounts module not found".
I also tried installing latest version of Az but also failed with the same error.
We are using Hosted agents.
I dont know what is wrong and why VS2017 is showing lower supported versions?
Please help!
I can provide more details if needed.
A colleague developed a terraform script that used version 0.14.x of Terraform. He uses a local Cloud Shell while I use the Cloud Shell in the GCP console.
The GCP console reports the terraform version as being 0.12.x.
How do you update the version to the latest? I tried following the Debian instructions from the Hashicorp web site and now, if I try to follow them again, I am told I have version 0.14.x installed but if I type terraform --version I still see 0.12.x.
What am I missing?
You can switch between versions of TF by typing the command tfswitch on your terminal.
or else what you can is to remove the old version from path
you can get the current version path from which terraform
you can remove the old release from the old path and add the binary to same place in GCP Cloud CLI.
You can directly download the zip into GCP cloud CLI using :
wget https://releases.hashicorp.com/terraform/0.14.7/terraform_0.14.7_linux_amd64.zip
unzip and set the binary at the same path
I have created a web app on Microsoft Azure and choosen Python 3.8 as configuration.
Then I set up a deployment pipeline on Azure DevOps which deploys a django app into the web app. The deployment itself also runs fine, artifacts are copied and unzipped. But the installation of the requirements is giving me a hard time.
On the Configuration section for the Web App on Azure portal I defined "Python 3.8" in the general settings. And in the Azure DevOps pipeline the deployment task is configured to use "PYTHON|3.8" as runtime stack.
But still the post deployment actions do fail - and this as it looks like is caused by the Kundu component which executes the task and itself is running python 3.5 (python3) and python 2.7 (python).
The pip installation for django 3.1.4 then fails with error and I am getting warnings about end of life python 3.5.
Here's deployment step and full output of it
#Your build pipeline references an undefined variable named ‘Parameters.ConnectedServiceName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.WebAppKind’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.WebAppName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.StartupCommand’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.PythonAppFramework’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: AzureRmWebAppDeployment#4
displayName: 'Deploy Azure App Service'
inputs:
azureSubscription: '$(Parameters.ConnectedServiceName)'
appType: '$(Parameters.WebAppKind)'
WebAppName: '$(Parameters.WebAppName)'
packageForLinux: '$(System.DefaultWorkingDirectory)/_xxx-CI/drop/xxx**.zip'
RuntimeStack: 'PYTHON|3.8'
StartupCommand: '$(Parameters.StartupCommand)'
ScriptType: 'Inline Script'
InlineScript: |
echo "Printing version of python3"
python3 --version
echo "Upgrading pip"
/usr/bin/python3 -m pip install --upgrade pip
echo "Installing requirements"
/usr/bin/python3 -m pip install -r xxx/requirements.txt
WebConfigParameters: '$(Parameters.PythonAppFramework)'
2020-12-26T14:52:34.2216420Z ##[section]Starting: Deploy Azure App Service
2020-12-26T14:52:34.2227205Z ==============================================================================
2020-12-26T14:52:34.2227775Z Task : Azure App Service deploy
2020-12-26T14:52:34.2228172Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2020-12-26T14:52:34.2228532Z Version : 4.179.0
2020-12-26T14:52:34.2228747Z Author : Microsoft Corporation
2020-12-26T14:52:34.2229021Z Help : https://aka.ms/azureappservicetroubleshooting
2020-12-26T14:52:34.2229517Z ==============================================================================
2020-12-26T14:52:35.2840047Z Got service connection details for Azure App Service:'xxx-dev'
2020-12-26T14:53:22.4215194Z Package deployment using ZIP Deploy initiated.
2020-12-26T14:54:12.3861589Z Deploy logs can be viewed at https://xxx-dev.scm.azurewebsites.net/api/deployments/b87f0b8e9bee48e6a823e1ef681812dd/log
2020-12-26T14:54:12.3866079Z Successfully deployed web package to App Service.
2020-12-26T14:54:13.3092961Z Trying to update App Service Application settings. Data: {"SCM_COMMAND_IDLE_TIMEOUT":"1800"}
2020-12-26T14:54:13.3105380Z App Service Application settings are already present.
2020-12-26T14:54:13.5984663Z Executing given script on Kudu service.
2020-12-26T14:54:33.9532357Z Standard output from script:
2020-12-26T14:54:33.9534448Z Printing version of python3
2020-12-26T14:54:33.9534739Z Python 3.5.3
2020-12-26T14:54:33.9534967Z Upgrading pip
2020-12-26T14:54:33.9535578Z Defaulting to user installation because normal site-packages is not writeable
2020-12-26T14:54:33.9536860Z Requirement already satisfied: pip in /home/.local/lib/python3.5/site-packages (20.3.3)
2020-12-26T14:54:33.9537372Z Installing requirements
2020-12-26T14:54:33.9537892Z Defaulting to user installation because normal site-packages is not writeable
2020-12-26T14:54:33.9538291Z Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
2020-12-26T14:54:33.9538602Z
2020-12-26T14:54:33.9544250Z Standard error from script:
2020-12-26T14:54:33.9593269Z ##[error]DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement django==3.1.4
ERROR: No matching distribution found for django==3.1.4
2020-12-26T14:54:34.7576240Z ##[error]Error: Unable to run the script on Kudu Service. Error: Error: Executed script returned '1' as return code. Error: DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement django==3.1.4
ERROR: No matching distribution found for django==3.1.4
2020-12-26T14:54:36.2470993Z Successfully updated deployment History at https://xxx-dev.scm.azurewebsites.net/api/deployments/321608994474759
2020-12-26T14:54:36.5240518Z App Service Application URL: http://xxx-dev.azurewebsites.net
2020-12-26T14:54:36.5358824Z ##[section]Finishing: Deploy Azure App Service
is this known - and more important is there a way to fix this?
Interestingly, when I ssh into the web app / app service and execute the commands all works fine
The Python 3.5.3 is the default version installed in root folders on the server. If you go to Azure App Service Kudu console to check the Python version, it will return the same result (Python 3.5.3).
When creating the App Services on Azure Portal, specifying Runtime Stack as Python 3.8 will not automatically install Python 3.8 and set it as the default for your App Services on the server. You need to manually set up the version on for your App Services on Azure Portal.
According to my test, using Inline Script on the Azure App Service deploy task to upgrade the Python version is not available.
I recommend that you can reference to the article "How to set up a Python environment on Azure App Service (Windows)" to set up Python 3.8 for your App Services on Azure Portal.
ran-msft,
thank you for the hint, I already stumbled across this guide. Unfortunately the app service is not Windows based but Linux based. And according the outcome of some research the installation of Extensions is not possible on Linux based Web App.
Trying to set up a n ew Web App and selecting Runtime stack "Python 3.8" only Operating System "Linux" is available
I also tried to change (recreate) the Web App to be on runtime stack "Python 3.6" (which allows a Windows Operating System). But then the Extension installation does not allow to go beyond Python 3.6.
I want to install Azure PowerShell in my windows 10, but I met an error message, I tried to find the reason for the error and found there was no package when I ran Get-PSRepository.
Background:
Install azure with code as below:
Install-Module -Name Az -AllowClobber -Scope AllUsers
Install-Module -Name Az -Repository PSGallery -Force
Error message:
Can't find the package at C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1748
Register-PSRepository -Default
Get-PSRepository shows can't find the package.
net winhttp show proxy shows without proxy server
what should I do to install the azure PowerShell?
Based on your error message, it seems that you have connection issue to powershell gallery
So, my first suggestion is to check your network environment work. Also remember to check your system proxy settings.
If your network has no problem, you may download package manually and then install modules from the downloaded nuget package
Another choice is to use Azure Cloud Shell
Hope the above could be helpful to you!
According to Powershell Gallery the 3.1.0 version of AzureRM.KeyVault contains cmdlets supporting Azure Storage accounts whose keys are managed by KeyVault. I installed and Get-Module shows the 3.1.0 version, but I am not seeing (in ExportedCommands) the various commands to support storage.
Here are the steps I would do.
Shutdown all powershell processes or reboot
Go to c:\program files\windowspowershell\modules and delete the folder with the AzureRM.keyvault in name
Launch powershell and install the module Install-Module -Name AzureRM.KeyVault