Powershell: Can't import-module Core AzureRM on Mac

Created on 23 Jun 2017  路  44Comments  路  Source: PowerShell/PowerShell

Hello,
When trying to import Azure Core modules, I am getting the following error on latest Mac OS:

Import-Module : Could not load file or assembly 'Microsoft.Azure.Commands.ResourceManager.Common, Version=1.6.0.0, Cultur
e=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
At line:1 char:1

  • Import-Module AzureRM.Profile.NetCore.Preview
  • ~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException

    • FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

$PSVersionTable

Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.3
OS Darwin 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Issue-Discussion Resolution-Answered

Most helpful comment

Just got published: https://www.powershellgallery.com/packages/AzureRM.Netcore/0.9.1

install-module azurerm.netcore -scope currentuser

All 44 comments

I get the same error. I first ran

Install-Package -Name AzureRM.NetCore.Preview -Source https://www.powershellgallery.com/api/v2 -ProviderName NuGet -ExcludeVersion -Destination /usr/local/share/powershell/Modules

And after that Import-Module AzureRM.Profile.NetCore.Preview, where I get the same error as @unbreakabl3.

Get-Module -ListAvailable shows the following:

    Directory: /usr/local/share/powershell/Modules


ModuleType Version    Name                                ExportedCommands                                             
---------- -------    ----                                ----------------                                             
Manifest   0.3.4      AzureRM.NetCore.Preview                                                                          
Manifest   0.3.4      AzureRM.Profile.NetCore.Preview     {Login-AzureRmAccount, Select-AzureRmSubscription}           
Manifest   0.3.4      AzureRM.Resources.NetCore.Preview                                                                


    Directory: /usr/local/microsoft/powershell/6.0.0-beta.3/Modules


ModuleType Version    Name                                ExportedCommands                                             
---------- -------    ----                                ----------------                                             
Manifest   1.1.0.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}                           
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                          
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy,...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}   
Script     1.1.4.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     3.3.9      Pester                              {Describe, Context, It, Should...}                           
Script     1.1.3.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...} 
Script     0.0        PSDesiredStateConfiguration         {ThrowError, Get-PSMetaConfigDocumentInstVersionInfo, New-...
Script     1.2        PSReadLine                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remov...

Thank you in advance.

I would like to report the exact same behaviour, but where it appears to occur for any call made.

PS /> $PSVersionTable                                                                                                                       

Name                           Value                                                                                                       
----                           -----                                                                                                       
PSVersion                      6.0.0-beta                                                                                                  
PSEdition                      Core                                                                                                        
GitCommitId                    v6.0.0-beta.3                                                                                               
OS                             Darwin 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X...
Platform                       Unix                                                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                     
PSRemotingProtocolVersion      2.3                                                                                                         
SerializationVersion           1.1.0.1                                                                                                     
WSManStackVersion              3.0 

Examples

PS /> Install-Package PSScriptAnalyzer                                                                                                      
Unable to find the specified file.
At line:1 char:1
+ Install-Package PSScriptAnalyzer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException

PS /> Get-Command -verb Install                                                                                                             

CommandType     Name                                               Version    Source                                                       
-----------     ----                                               -------    ------                                                       
Function        Install-Module                                     1.1.3.1    PowerShellGet                                                
Function        Install-Script                                     1.1.3.1    PowerShellGet                                                
Cmdlet          Install-Package                                    1.1.4.0    PackageManagement                                            
Cmdlet          Install-PackageProvider                            1.1.4.0    PackageManagement     

PS /> Get-ChildItem -Path /                                                                                                                 
Unable to find the specified file.
At line:1 char:1
+ Get-ChildItem -Path /
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException

PS /> Get-Command Get-ChildItem                                                                                                             
Get-Command : Unable to find the specified file.
At line:1 char:1
+ Get-Command Get-ChildItem
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Command], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Hum!! I don't think the 'PSScriptAnalyzer' can be installed in PowerShell Core Linux and is not part of AzureRM module.

You can use the following command to identify what's been tag for Linux:

Find-Module -tag Linux

For sure there's a lot of work to be done in the PSGallery to properly identify the difference between Windows PowerShell vs PowerShell Core as they are not the same.

Hope this will clear some confusion,
:)

psgallerylinux_2017-06-26_7-05-51

I don't believe it is just PSScriptAnalyzer not being able to run on OSX. I ran the command you suggested Find-Module with the same result.

PowerShell v6.0.0-beta.3
Copyright (C) Microsoft Corporation. All rights reserved.

PS /> Find-Module -tag Linux                                                                                                                
Unable to find the specified file.
At line:1 char:1
+ Find-Module -tag Linux
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException

Well, this is interesting. I just tried for the hell of it to change back to my $HOME directory and it worked.

PowerShell v6.0.0-beta.3
Copyright (C) Microsoft Corporation. All rights reserved.

PS /Users/*******> Find-Module -tag Linux                                                                                                    

Version    Name                                Repository           Description                                                            
-------    ----                                ----------           -----------                                                            
1.1.4.0    PackageManagement                   PSGallery            PackageManagement (a.k.a. OneGet) is a new way to discover and insta...
1.1.3.1    PowerShellGet                       PSGallery            PowerShell module with commands for discovering, installing, updatin...
0.3.4      AzureRM.Profile.NetCore.Preview     PSGallery            [PowerShell Core Edition] Microsoft Azure PowerShell - Profile crede...
1.1.0.0    Microsoft.PowerShell.Archive        PSGallery            PowerShell module for working with ZIP archives.                       
0.3.4      AzureRM.Resources.NetCore.Preview   PSGallery            [PowerShell Core Edition] Microsoft Azure PowerShell - Azure Resourc...
0.3.4      AzureRM.NetCore.Preview             PSGallery            [PowerShell Core Edition] Azure Resource Manager Module - Management...
1.0.0      SSH                                 PSGallery            Provides a PowerShell-based SSH client based on SSH.net  http://sshn...
1.7.3.9    PoshRSJob                           PSGallery            Module designed to use PowerShell runspaces to create jobs that allo...
2.0.4      Posh-SYSLOG                         PSGallery            Send SYSLOG messages from PowerShell                                   
1.1.6.0    Microsoft.PowerShell.ODataUtils     PSGallery            Generates CDXML modules that contain cmdlets to manage OData and Red...
0.1.1      PSPuTTY                             PSGallery            This PowerShell module enables you to switch between color themes fo...
0.5.1.0    PSReleaseTools                      PSGallery            A set of commands for working with PowerShell 6.0 releases             

Previously, I was running out of the root folder / (I have just noticed). So is there something going on under the hood of PS and using relative paths or something else from where you currently are.

OK. I think I have found the possible cause.

  1. I was working in a particular folder in a bash session.
  2. Done some stuff, then deleted the same working folder via OSX Finder.
  3. Updated PowerShell to v6 beta 3 on my Mac OSX.
  4. Then back in the bash session without changing the working directory, started powershell.
  5. Not realising that the PS prompt PS /> indicated that I was supposedly working in /.
  6. Executing the command $PSVersionTable obviously works as it not having to load up a script, cmdlet or module.
  7. Executing a call against a function where it wants to load a script, cmdlet or module is where the problem lies.

I have been able to replicate this by repeating the process in session 1 changing to a folder like /tmp/test, then in another session (2) removing the /tmp/test, then back to the first session and run PS. Run a command calling a function and bingo - same result.

Unix (and I assume for now Linux as well) do not lock a folder if another session is currently pointing to it or have a file open like Windows does. Hence the dramas.

Anyway, I personally don't see this as a major bug, but the error message is not accurate as to the actual cause, but how or what is the best message to return, and how would PS determine the situation before running the executing command.

Ah!! @amhendley

Too bad I don't have a Mac! :(

It works on Ubuntu 16.04,2.

Hello. I am also seeing the same issue. I don't appear to be in the same situation as @amhendley .

PS /Users/******> get-module -listavailable azurerm.*                          


    Directory: /usr/local/microsoft/powershell/6.0.0-beta.3/Modules


ModuleType Version    Name                                ExportedCommands     
---------- -------    ----                                ----------------     
Manifest   0.3.4      AzureRM.NetCore.Preview                                  
Manifest   0.3.4      AzureRM.Profile.NetCore.Preview     {Login-AzureRmAcco...
Manifest   0.3.4      AzureRM.Resources.NetCore.Preview                        


Getting the same error on the import.

PS /Users/*****> get-module -listavailable azurerm.* | import-module          
Import-Module : Could not load file or assembly 
'Microsoft.Azure.Commands.ResourceManager.Common, Version=1.6.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the 
file specified.
At line:1 char:1
+ get-module -listavailable azurerm.* | import-module
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundE 
   xception
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS 
   hell.Commands.ImportModuleCommand

PS /Users/*****> $psversiontable                                              

Name                           Value                                           
----                           -----                                           
PSVersion                      6.0.0-beta                                      
PSEdition                      Core                                            
GitCommitId                    v6.0.0-beta.3                                   
OS                             Darwin 16.6.0 Darwin Kernel Version 16.6.0: F...
Platform                       Unix                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                         
PSRemotingProtocolVersion      2.3                                             
SerializationVersion           1.1.0.1                                         
WSManStackVersion              3.0                                             

I would hold off on trying to use the Azure.NetCore.Preview module on Mac/Linux. They have a new release coming, but it's blocked by a CoreFx bug and waiting on us to pick up a new dotnet core that has the fix. Hopefully the stars align and everything works out in time for beta.4

Hi @SteveL-MSFT,

That sounds promising. Any word on what the timeline is for the new release?

Thanks!

I thought this was already been addressed back in the Alpha version: https://github.com/PowerShell/PowerShell/issues/3577

:)

@januschr we're working with Azure PowerShell team closely, but the underlying issue is in dotnet. beta.4 is targeted for 7/13. I

@SteveL-MSFT Awesome!!
That's just around the corner!
:)

so it's tomorrow, any updates? thanks!

Hello,

@SteveL-MSFT : Any ETA regarding >>> "beta.4 is targeted for 7/13." <<<< Thank you.

I've just installed beta 4, nothing changed. cannot import AzureRM.NetCore.Preview

Azure PowerShell team hasn't published a necessary update yet to Azure.NetCore.Preview module. We're still working with them on this. No ETA, hopefully next week.

please keep us updated here @SteveL-MSFT thanks!

Hello Lee, @SteveL-MSFT any chance to have this fixed ? - Still stuck, can not use Powershell/Azure on Mac - Many thanks in advance. Kind regards. Laurent.

With beta4 out, I thought I would give it another go. First I removed beta3 and any modules that had been previously installed.

I downloaded the beta4 package and installed it, and from the PowerShell prompt:

Install-Module AzureRM.NetCore.Preview
Import-Module AzureRM.NetCore.Preview

Import-Module fails with this message:

Import-Module : Exception has been thrown by the target of an invocation.
At line:1 char:1
+ Import-Module AzureRM.NetCore.Preview
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], TargetInvocationException
    + FullyQualifiedErrorId :     System.Reflection.TargetInvocationException,Microsoft.PowerShell.Commands.ImportModuleCommand

Keeping my fingers crossed for a solution to this, and thank you!

Sorry no update that I'm aware of yet.

Just got published: https://www.powershellgallery.com/packages/AzureRM.Netcore/0.9.1

install-module azurerm.netcore -scope currentuser

Thanks, working now!

Does not work for me - is this related ? -

NB : I have removed BETA3 & installed BETA4
run terminal

powershell
it confirmed BETA4 has been installed

Try to import modules
PS > Import-Module azureRM

Import-Module : Could not load file or assembly 'System.Windows.Forms,

Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system
cannot find the file specified.
At /usr/local/microsoft/powershell/6.0.0-beta.4/Modules/azureRM/4.2.1/AzureRM.p
sm1:15 char:3

  • Import-Module AzureRM.Profile -RequiredVersion 3.2.1

Many thanks in advance.
Laurent.

Well.. weird. After trying multiple time it worked.. import azureRM modules

PS /Users/laurentprat> import-module azureRM
PS /Users/laurentprat> import-module azureRM
PS /Users/laurentprat> Get-Module -All

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.4.2 Azure.AnalysisServices {Add-AzureAnalysisServicesAccount, Export-AzureAnalysisServicesInstanceLog, Restart-AzureAnalysisS...
Script 3.2.1 Azure.Storage {Get-AzureStorageBlob, Get-AzureStorageBlobContent, Get-AzureStorageBlobCopyState, Get-AzureStorag...
Script 4.2.1 azureRM {Add-AzureAnalysisServicesAccount, Add-AzureKeyVaultCertificate, Add-AzureKeyVaultCertificateConta...
Script 0.4.2 AzureRM.AnalysisServices {Get-AzureRmAnalysisServicesServer, New-AzureRmAnalysisServicesServer, Remove-AzureRmAnalysisServi...

Got some other issues, will check other trackers.

Best regards,
Laurent.

@LaurentPrat how are you importing AzureRM on linux? O_O you are supposed to load azurerm.netcore

@4c74356b41, I am importing on Mac. (assuming it's the same for Linux). Module does not seems to be case sensitive.. and you are right azureRM.netcore loads fine

Manifest 0.9.1 azurerm.netcore

Will see if there are tracker regarding: Script 4.2.1 azureRM
as I need to login to Azure account with PS (ideally from my Mac)

Thank you.

@SteveL-MSFT install and import does not produce any errors anymore, and I can login to Azure from PowerShell on Mac now. Thanks!

@januschr : Do you mind sharing. I am following an MS tuto to login:

Once the download and installation is finished, run the Import-Module Azure command.
Run the Login-AzureRmAccount command and then authenticate with your Azure
administrative credentials

Thank in advance.
Best regards,
Laurent.

Yes, sure, is it the login process you are uncertain about?
You just enter Login-AzureRmAccount on the Powershell prompt, it will then tell to go to https://aka.ms/devicelogin in a browser and enter the code Login-AzureRmAccount shows you.

When you enter the code, you will be prompted to enter login and password to Azure. This will create a session in Powershell, giving you back the prompt.

Hope this helps,
Janus

Just installed AzureRM.Netcore/0.9.1 on beta4 on linux and it works flawlessly.
The login procedure works just as @januschr described

@tlisiecki & @januschr Thank you so much for your support.

The issue I have (on Mac) after successfully importing AzureRM (Import-Module AzureRM), is that when running the command : PS > Login-AzureRmAccount

I got an error, see #4389

Best regards,
L.

@LaurentPrat are you sure you installed AzureRM.netcore and not AzureRM. Both of them are on powershellgallery but to run on linux or mac AzureRM.netcore is required.

Steve posted the command to do exactly that:
install-module azurerm.netcore -scope currentuser

Also - can you post the output of:
Get-Module -ListAvailable |Where-Object {$_.Name -like 'AzureRM*'}

@tlisiecki . Actually I had installed AzureRM long time back and was stuck waiting for the fix
I did applied as specified by Steve. Still after that I ran into the issue explained, that Login command does not load.

Please see below the output request - Many thanks in advance

PS /Users/laurentprat> Get-Module -ListAvailable |Where-Object {$_.Name -like 'AzureRM*'}

Directory: /Users/laurentprat/.local/share/powershell/Modules

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 0.9.1 AzureRM.Compute.Netcore {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet, New-AzureRmAvailabilitySet, Update-Azu...
Manifest 0.9.1 AzureRM.Netcore
Manifest 0.9.1 AzureRM.Network.Netcore {Add-AzureRmApplicationGatewayAuthenticationCertificate, Get-AzureRmApplicationGatewayAuthenticati...
Manifest 0.9.1 AzureRM.Profile.Netcore {Disable-AzureRmDataCollection, Enable-AzureRmDataCollection, Remove-AzureRmEnvironment, Get-Azure...
Manifest 0.9.1 AzureRM.Resources.Netcore {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAssignment, New-AzureR...
Manifest 0.9.1 AzureRM.Storage.Netcore {Get-AzureRmStorageAccount, Get-AzureRmStorageAccountKey, New-AzureRmStorageAccount, New-AzureRmSt...
Manifest 0.9.1 AzureRM.Tags.Netcore {Remove-AzureRmTag, Get-AzureRmTag, New-AzureRmTag}
Manifest 0.9.1 AzureRM.Websites.Netcore {Get-AzureRmAppServicePlan, Set-AzureRmAppServicePlan, New-AzureRmAppServicePlan, Remove-AzureRmAp...

Directory: /usr/local/microsoft/powershell/6.0.0-beta.4/Modules

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 4.2.1 AzureRM {Remove-AzureRmSiteRecoveryServicesProvider, Get-AzureRmVMImageSku, Set-AzureRmVirtualNetworkGatew...
Script 0.4.2 AzureRM.AnalysisServices {Resume-AzureRmAnalysisServicesServer, Suspend-AzureRmAnalysisServicesServer, Get-AzureRmAnalysisS...
Script 4.2.1 AzureRM.ApiManagement {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementSsoToken, New-AzureRmApiManagementHostnam...
Script 3.2.1 AzureRM.Automation {Get-AzureRMAutomationHybridWorkerGroup, Get-AzureRmAutomationJobOutputRecord, Import-AzureRmAutom...
Script 3.2.1 AzureRM.Backup {Backup-AzureRmBackupItem, Enable-AzureRmBackupContainerReregistration, Get-AzureRmBackupContainer...
Script 3.2.1 AzureRM.Batch {Remove-AzureRmBatchAccount, Get-AzureRmBatchAccount, Get-AzureRmBatchAccountKeys, New-AzureRmBatc...
Script 0.13.2 AzureRM.Billing {Get-AzureRmBillingInvoice, Get-AzureRmBillingPeriod}
Script 3.2.1 AzureRM.Cdn {Get-AzureRmCdnProfile, Get-AzureRmCdnProfileSsoUrl, New-AzureRmCdnProfile, Remove-AzureRmCdnProfi...
Script 0.8.2 AzureRM.CognitiveServices {Get-AzureRmCognitiveServicesAccount, Get-AzureRmCognitiveServicesAccountKey, Get-AzureRmCognitive...
Script 3.2.1 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet, New-AzureRmAvailabilitySet, Update-Azu...
Script 0.2.2 AzureRM.Consumption Get-AzureRmConsumptionUsageDetail
Script 0.2.2 AzureRM.ContainerRegistry {New-AzureRmContainerRegistry, Get-AzureRmContainerRegistry, Update-AzureRmContainerRegistry, Remo...
Script 3.2.1 AzureRM.DataFactories {Remove-AzureRmDataFactory, Get-AzureRmDataFactoryRun, Get-AzureRmDataFactorySlice, Save-AzureRmDa...
Script 3.2.1 AzureRM.DataLakeAnalytics {Get-AzureRmDataLakeAnalyticsDataSource, New-AzureRmDataLakeAnalyticsCatalogCredential, Remove-Azu...
Script 4.2.1 AzureRM.DataLakeStore {Get-AzureRmDataLakeStoreTrustedIdProvider, Remove-AzureRmDataLakeStoreTrustedIdProvider, Remove-A...
Script 3.2.1 AzureRM.DevTestLabs {Get-AzureRmDtlAllowedVMSizesPolicy, Get-AzureRmDtlAutoShutdownPolicy, Get-AzureRmDtlAutoStartPoli...
Script 3.2.1 AzureRM.Dns {Get-AzureRmDnsRecordSet, New-AzureRmDnsRecordConfig, Remove-AzureRmDnsRecordSet, Set-AzureRmDnsRe...
Script 0.4.2 AzureRM.EventHub {New-AzureRmEventHubKey, Get-AzureRmEventHubNamespace, Get-AzureRmEventHubNamespaceAuthorizationRu...
Script 3.2.1 AzureRM.HDInsight {Get-AzureRmHDInsightJob, New-AzureRmHDInsightSqoopJobDefinition, Wait-AzureRmHDInsightJob, New-Az...
Script 3.2.1 AzureRM.Insights {Get-AzureRmUsage, Get-AzureRmMetricDefinition, Get-AzureRmMetric, Remove-AzureRmLogProfile...}
Script 2.2.1 AzureRM.IotHub {Add-AzureRmIotHubKey, Get-AzureRmIotHubEventHubConsumerGroup, Get-AzureRmIotHubConnectionString, ...
Script 3.2.1 AzureRM.KeyVault {Add-AzureKeyVaultCertificate, Set-AzureKeyVaultCertificateAttribute, Stop-AzureKeyVaultCertificat...
Script 3.2.1 AzureRM.LogicApp {Get-AzureRmIntegrationAccountAgreement, Get-AzureRmIntegrationAccountCallbackUrl, Get-AzureRmInte...
Script 0.15.2 AzureRM.MachineLearning {Move-AzureRmMlCommitmentAssociation, Get-AzureRmMlCommitmentAssociation, Get-AzureRmMlCommitmentP...
Script 0.7.2 AzureRM.Media {Sync-AzureRmMediaServiceStorageKeys, Set-AzureRmMediaServiceKey, Get-AzureRmMediaServiceKeys, Get...
Script 4.2.1 AzureRM.Network {Add-AzureRmApplicationGatewayAuthenticationCertificate, Get-AzureRmApplicationGatewayAuthenticati...
Script 3.2.1 AzureRM.NotificationHubs {Get-AzureRmNotificationHub, Get-AzureRmNotificationHubAuthorizationRules, Get-AzureRmNotification...
Script 3.2.1 AzureRM.OperationalInsights {New-AzureRmOperationalInsightsAzureActivityLogDataSource, New-AzureRmOperationalInsightsCustomLog...
Script 3.2.1 AzureRM.PowerBIEmbedded {Remove-AzureRmPowerBIWorkspaceCollection, Get-AzureRmPowerBIWorkspaceCollection, Get-AzureRmPower...
Script 3.2.1 AzureRM.profile {Disable-AzureRmDataCollection, Enable-AzureRmDataCollection, Remove-AzureRmEnvironment, Get-Azure...
Script 3.2.1 AzureRM.RecoveryServices {Get-AzureRmRecoveryServicesBackupProperty, Get-AzureRmRecoveryServicesVault, Get-AzureRmRecoveryS...
Script 3.2.1 AzureRM.RecoveryServices.Backup {Backup-AzureRmRecoveryServicesBackupItem, Get-AzureRmRecoveryServicesBackupManagementServer, Get-...
Script 3.2.1 AzureRM.RedisCache {Remove-AzureRmRedisCachePatchSchedule, New-AzureRmRedisCacheScheduleEntry, Get-AzureRmRedisCacheP...
Script 0.2.2 AzureRM.Relay {New-AzureRmRelayNamespace, Get-AzureRmRelayNamespace, Set-AzureRmRelayNamespace, Remove-AzureRmRe...
Script 4.2.1 AzureRM.Resources {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAssignment, New-AzureR...
Script 0.15.2 AzureRM.Scheduler {Disable-AzureRmSchedulerJobCollection, Enable-AzureRmSchedulerJobCollection, Get-AzureRmScheduler...
Script 3.2.1 AzureRM.ServerManagement {Invoke-AzureRmServerManagementPowerShellCommand, Get-AzureRmServerManagementSession, New-AzureRmS...
Script 0.4.2 AzureRM.ServiceBus {Get-AzureRmServiceBusTopic, Get-AzureRmServiceBusTopicAuthorizationRule, Get-AzureRmServiceBusTop...
Script 0.2.2 AzureRM.ServiceFabric {Add-AzureRmServiceFabricApplicationCertificate, Add-AzureRmServiceFabricClientCertificate, Add-Az...
Script 4.2.1 AzureRM.SiteRecovery {Get-AzureRmSiteRecoveryFabric, New-AzureRmSiteRecoveryFabric, Remove-AzureRmSiteRecoveryFabric, S...
Script 3.2.1 AzureRM.Sql {Get-AzureRmSqlDatabaseTransparentDataEncryption, Get-AzureRmSqlDatabaseTransparentDataEncryptionA...
Script 3.2.1 AzureRM.Storage {Get-AzureRmStorageAccount, Get-AzureRmStorageAccountKey, New-AzureRmStorageAccount, New-AzureRmSt...
Script 3.2.1 AzureRM.StreamAnalytics {Get-AzureRmStreamAnalyticsFunction, Get-AzureRmStreamAnalyticsDefaultFunctionDefinition, New-Azur...
Script 3.2.1 AzureRM.Tags {Remove-AzureRmTag, Get-AzureRmTag, New-AzureRmTag}
Script 3.2.1 AzureRM.TrafficManager {Disable-AzureRmTrafficManagerEndpoint, Enable-AzureRmTrafficManagerEndpoint, Set-AzureRmTrafficMa...
Script 3.2.1 AzureRM.UsageAggregates Get-UsageAggregates
Script 3.2.1 AzureRM.Websites {Get-AzureRmAppServicePlan, Set-AzureRmAppServicePlan, New-AzureRmAppServicePlan, Remove-AzureRmAp...

@LaurentPrat so how did you port full net framework (to use AzureRM) to macos?

@4c74356b41 Not sure I am following your mind - fyi, I have just installed the cross platform PowerShell package - the last is BETA4 for MacOs check the download page (powershell-6.0.0-beta.4-osx.10.12-x64.pkg).

@LaurentPrat well I guess there is some clash on command names from different modules and the proper modules do not auto load.
I bielieve you could try
Import-Module AzureRM.Netcore and then try to log in.

But if I were you I`d first uninstall AzureRM module completely. AzureRM is a module running on Full .NET framework as 4c74356b41 suggests between lines :) and there is no way it would ever run on linux/mac.

On mac you have powershell core, based on .NET core framework and thus you need AzureRM.netcore module.
Hope that is clear enough.

Is PSCredential objects supposed to work in the current version of Add-AzureRmAccount?

I get this error:

PS C:\Program Files\PowerShell\6.0.0-beta.4> $cred = Get-Credential

Windows PowerShell credential request
Enter your credentials.
User: [email protected]
Password for user [email protected]: **

PS C:\Program Files\PowerShell\6.0.0-beta.4> Add-AzureRmAccount -Credential $cred
Add-AzureRmAccount : accessing_ws_metadata_exchange_failed: Accessing WS metadata exchange failed: Response status cod
e does not indicate success: 406 (NotAcceptable).
At line:1 char:1

  • Add-AzureRmAccount -Credential $cred
  • ~~~~~~~~

    • CategoryInfo : CloseError: (:) [Add-AzureRmAccount], AadAuthenticationFailedException

    • FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.AddAzureRMAccountCommand

PS C:\Program Files\PowerShell\6.0.0-beta.4>

@tlisiecki

uninstalling/reinstalling, then checked the AzureRM* modules - where I saw there are only the AzureRM.netcore (Manifest 0.91) ...

And it fixed it. As of now, can login, and execute powershell command successfully ;)

btw, I have closed the #4389

Thank you so much

@LaurentPrat You`re most welcome :)

@janegilring id doesn`t work for me either, but I get some different Exception

PS /home/liske> $cred = Get-Credential                                                                                                                                                                                                                                                                                                                                                                    Windows PowerShell credential request                                                                                                                                                                Enter your credentials.                                                                                                                                                                              User: XXXX                                                                                                                                                              
Password for user XXXX: *************

PS /home/liske> Add-AzureRmAccount -Credential $cred                                                                                                                                                 
Add-AzureRmAccount : password_required_for_managed_user: Password is required for managed user
At line:1 char:1
+ Add-AzureRmAccount -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureRmAccount], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.AddAzureRMAccountCommand

PS /home/liske>

@tlisiecki Thanks for confirming. Forgot to mention that I ran PS Core on Windows 10, which is likely why we got slightly different error messages (you seem to be running a different OS).

FYI: I`ve submitted an issue in the Azure PowerShell repository

Tried hundred of times finally made 1 step, after installed azurerm.netcore module, just import modules end with "netcore".
Get-Module -ListAvailable azurerm*netcore | Import-Module
PSVersion

> Name                           Value                                                                                                                                                        
> ----                           -----                                                                                                                                                        
> PSVersion                      6.0.0-beta                                                                                                                                                   
> PSEdition                      Core                                                                                                                                                         
> GitCommitId                    v6.0.0-beta.5                                                                                                                                                
> OS                             Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64                                               
> Platform                       Unix                                                                                                                                                         
> PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                      
> PSRemotingProtocolVersion      2.3                                                                                                                                                          
> SerializationVersion           1.1.0.1                                                                                                                                                      
> WSManStackVersion              3.0

@SteveL-MSFT hey there, do you know why each time i run azure powershell it prompts for datacollection? it honestly looks like a bug. the '/home/user/.config/Windows Azure Powershell/AzureDataCollectionProfile.json' file is there and contains: {"enableAzureDataCollection":true}, yet each time i open new session and run azure cmdlets it prompts if i want to collect data

@4c74356b41 don't know, best to open an issue in their repo

Was this page helpful?
0 / 5 - 0 ratings