Login-AzureRmAccount: the term "Login-AzureRmAccount" is not recognized as the name of the cmdlet, function, script

I have a problem with Azure PS modules. I installed the following through the PS gallery:

Install-Module AzureRM Install-Module Azure 

(and restarted)

However, when I run Login-AzureRmAccount , I get the following error:

Login-AzureRmAccount: The term "Login-AzureRmAccount" is not recognized as the name of the cmdlet, function, script file, or working program. Check the spelling of the name or specify the path, check the path and try again. By line: 1 char: 1 + Login-AzureRmAccount + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo: ObjectNotFound: (Login-AzureRmAccount: String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

It seems that I have all the Azure modules installed. That is, if I run Get-Module -List , I get the following.

 Script 3.7.0 Azure {Get-AzureAutomationCertificate, Get-AzureAutomationConnec... Script 0.1.0 Azure.AnalysisServices {Add-AzureAnalysisServicesAccount, Restart-AzureAnalysisSe... Script 2.7.0 Azure.Storage {Get-AzureStorageTable, New-AzureStorageTableSASToken, New... Script 3.7.0 AzureRM {Update-AzureRM, Import-AzureRM, Uninstall-AzureRM, Instal... Script 0.1.0 AzureRM.AnalysisServices {Resume-AzureRmAnalysisServicesServer, Suspend-AzureRmAnal... Script 3.5.0 AzureRM.ApiManagement {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementS... Script 2.7.0 AzureRM.Automation {Get-AzureRMAutomationHybridWorkerGroup, Get-AzureRmAutoma... Script 2.7.0 AzureRM.Backup {Backup-AzureRmBackupItem, Enable-AzureRmBackupContainerRe... Script 2.7.0 AzureRM.Batch {Remove-AzureRmBatchAccount, Get-AzureRmBatchAccount, Get-... Script 2.7.0 AzureRM.Cdn {Get-AzureRmCdnProfile, Get-AzureRmCdnProfileSsoUrl, New-A... Script 0.5.0 AzureRM.CognitiveServices {Get-AzureRmCognitiveServicesAccount, Get-AzureRmCognitive... Script 2.8.0 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet... Script 2.7.0 AzureRM.DataFactories {Remove-AzureRmDataFactory, Get-AzureRmDataFactoryRun, Get... Script 2.7.0 AzureRM.DataLakeAnalytics {Get-AzureRmDataLakeAnalyticsDataSource, New-AzureRmDataLa... Script 3.5.0 AzureRM.DataLakeStore {Get-AzureRmDataLakeStoreTrustedIdProvider, Remove-AzureRm... Script 2.7.0 AzureRM.DevTestLabs {Get-AzureRmDtlAllowedVMSizesPolicy, Get-AzureRmDtlAutoShu... Script 2.7.0 AzureRM.Dns {Get-AzureRmDnsRecordSet, New-AzureRmDnsRecordConfig, Remo... Script 0.1.0 AzureRM.EventHub {New-AzureRmEventHubKey, Get-AzureRmEventHubNamespace, Get... Script 2.7.0 AzureRM.HDInsight {Get-AzureRmHDInsightJob, New-AzureRmHDInsightSqoopJobDefi... Script 2.7.0 AzureRM.Insights {Get-AzureRmUsage, Get-AzureRmMetricDefinition, Get-AzureR... Script 1.3.0 AzureRM.IotHub {Add-AzureRmIotHubKey, Get-AzureRmIotHubEventHubConsumerGr... Script 2.7.0 AzureRM.KeyVault {Add-AzureKeyVaultCertificate, Set-AzureKeyVaultCertificat... Script 2.7.0 AzureRM.LogicApp {Get-AzureRmIntegrationAccountAgreement, Get-AzureRmIntegr... Script 0.12.0 AzureRM.MachineLearning {Move-AzureRmMlCommitmentAssociation, Get-AzureRmMlCommitm... Script 0.4.0 AzureRM.Media {Sync-AzureRmMediaServiceStorageKeys, Set-AzureRmMediaServ... Script 3.6.0 AzureRM.Network {Add-AzureRmApplicationGatewayAuthenticationCertificate, G... Script 2.7.0 AzureRM.NotificationHubs {Get-AzureRmNotificationHub, Get-AzureRmNotificationHubAut... Script 2.7.0 AzureRM.OperationalInsights {New-AzureRmOperationalInsightsAzureActivityLogDataSource,... Script 2.7.0 AzureRM.PowerBIEmbedded {Remove-AzureRmPowerBIWorkspaceCollection, Get-AzureRmPowe... Script 2.7.0 AzureRM.profile {Disable-AzureRmDataCollection, Enable-AzureRmDataCollecti... ... 

Hope someone can help? Running on Windows Server 2012 R2 with Powershell 4

Hi

+13
powershell azure azure-resource-manager
source share
4 answers

You need to upgrade to the new version of Azure PowerShell.

  • Use the command:

AzureRM Installation Module -AllowClobber

Reference article: https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps

+9
source share

You can use the latest version of Azure Power Shell from.

Notes: Please install version 3.7.0.

enter image description here

+4
source share

For me, the Install-Module not recognized, and I already installed Azure 3.7, the answer was to install Azure CLI 2.0 for Windows

+1
source share

I had this problem when running a Powershell script as a scheduled task (using a user profile reserved for scheduled tasks), but not when interactively running from a Powershell prompt as administrator. (I used Powershell version 5.1.)

Get-Module -List seemed to tell me that the required AzureRm modules are already installed for all users (in the C: \ Program Files \ WindowsPowerShell \ Modules folder). However, it seemed that they were not installed for the user task.

I placed the installation procedure in a scheduled task to run the following commands in the context of my task:

 Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Install-Module AzureRM.Dns -Scope AllUsers -RequiredVersion 4.0.1 -AcceptLicense 

(version 4.0.1 seems to be already installed).

I also had to use the Install-Module PowershellGet -Force to get the "Scope" Install-Module parameter to accept. It was not clear which of the three teams had finally achieved their goal.

0
source share

All Articles