I am trying to install Azure CLI as described in Microsoft documentation "Install Azure CLI 2.0"1. The documentation seems out-of-date, hard to understand and has many issues associated with it. Each step in the documentation introduces new issues to fix first. An example is shown below.
PS C:\WINDOWS\system32> Install-Module AzureRM
Install-Module : The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be load
ed. For more information, run 'Import-Module PowerShellGet'.
At line:1 char:1
+ Install-Module AzureRM
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
PS C:\WINDOWS\system32>
or
PS C:\Users\ostraaten> Import-Module AzureRM
Import-Module : The specified module 'AzureRM' was not loaded because no valid module file was found in any mod
ctory.
At line:1 char:1
+ Import-Module AzureRM
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (AzureRM:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Are there other ways to get Azure CLI? Third-party installers for example. Is there more up-to-date documentation? Better tested documentation?
I cannot use btw the Azure CLI for Linux - which does work - because I need a reserved public static IP address which can only be created using MS Windows CLI for Windows. It also cannot be created through the portal. For reasons unknown.
I also tried the Cloud Shell where CLI is pre-installed but that version is older and doesn't include the method to create reserved IP address. Updating the CLI version in Cloud Shell is also not possible. It fails with an error message.
As a workaround, we can download Azure CLI 2.0 MSI and install it on your Windows PC.
We can download MSI here.
Update:
If you want to install Azure PowerShell, we can download Azure PowerShell MSI here.
More information, please refer to this link.
First of all, there is a difference between the Azure CLI and Azure Powershell.
The command Install-Module AzureRM installs the latter.
AzureCLI adds the az command. If you open a command prompt and just type az, you either see an error or a list of available commands. Note: on Windows 10 you can either install the CLI directly under Windows, or you can install it under the subsystem for linux.
Enabling Ubuntu Bash is described here:
Settings -> Update and Security -> For Developers -> Developer Mode
Control Panel -> Programs -> Windows Features -> Windows Subsystem for Linux
Installing the Azure CLI here is described here:
Azure PowerShell is another way of talking to the Azure REST API. The error you're getting indicates there's something wrong with your PowerShell Repository.
Did you verify Azure really isn't installed? You can test this by trying Login-AzureRmAccount.
If you get an error you may try Register-PSRepository -Default before following the steps here
Related
I have a couple of PowerShell scripts that can run using Windows PowerShell with no issue.
As soon as I run them in VS Code on the same computer, I get "Connect-MsGraph' is not recognized as the name of a cmdlet,
I have installed the same Microsoft.Graph.Intune and other relevant AAD modules for both Windows PowerShell and VS Code.
Any idea why I can't run them in the VS Code?
Thanks
Connect-MsGraph' is not recognized as the name of a cmdlet,
The issue happens because of the VS code is not able to access the PSModulePath in the system or it happens if you are not using the latest Microsoft.Graph SDK.
Try to install the module in a default path
Install-Module -Name Microsoft.Graph -RequiredVersion 1.2.0
Refer here if in your system default path contains OneDrive.
After adding the required modules in a default path try to restart the VS Code and System.
References
Connect MS Graph in VS Code
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.
I need to update Azure CLI, but I realized I had installed Azure CLI in 2019 and never update it since. I This is a Windows 10 machine. When I try to uninstall, by going to 'Apps & features' and uninstalling Microsoft Azure CLI, I see the following:
Screenshot
Error: Click OK to try again, or enter an alternate path to a folder containing the installation package 'azure-cli-2.0.75 (1).msi' in the box below.
The challenge, however, is that I am not able to find that particular version of the msi anywhere. I would greatly appreciate if someone could kindly point me in the right direction :)
You can uninstall the azure cli using the below command
Remove-Module -Name Az -ErrorAction SilentlyContinue
Uninstall-Module -Name Az -AllVersions
Using this one it will automatically uninstall in silent mode.
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