423,867 Members | 3,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,867 IT Pros & Developers. It's quick & easy.

Powershell getting empty subscription info when I login Azure

100+
P: 153
Hi I am trying to login Azure with powershell workflow and I get this result after authentication.

When i run this command in a powershell workflow and login withthe popup window I get the below empty subscription info.

When I do a normal powershell without workflow I get the subscription information back correctly.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Environment           : 
  4. Account               : 
  5. TenantId              : 
  6. SubscriptionId        : 
  7. SubscriptionName      : 
  8. CurrentStorageAccount : 
  9. PSComputerName        : localhost
I even tried saving the context outside the workflow and tried to use the context but got the error.
Expand|Select|Wrap|Line Numbers
  1. # Setup – First login manually 
  2. Add-AzureRmAccount 
  3.  
  4. # Now save your context locally (Force will overwrite if there) 
  5.     $ContextLocation=C:\Context\test
  6.  
  7. $path = "$ContextLocation\ProfileContext.ctx"
  8. Save-AzureRmContext -Path $path -Force 
  9.  
  10. #Once that’s done, from then on you can use the Import-AzureRmContext to automate the login.
  11.  
  12.  
  13. # Once the above two steps are done, you can simply import  
  14. Import-AzureRmContext -Path $path 
  15.  
  16. I got this error:
  17. Run Login-AzureRmAccount to login.
  18.     + CategoryInfo          : InvalidOperation: (:) [Remove-AzureRmResourceGroup], PSInvalidOperationException
  19.     + FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.Resources.RemoveAzureResourceGroupCmdlet
  20.     + PSComputerName        : [localhost]
How can i get this to return the subscription info using powershell workflow? Could someone help please.
Aug 28 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.