Powershell getting empty subscription info when I login Azure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonathan184
    New Member
    • Nov 2006
    • 154

    Powershell getting empty subscription info when I login Azure

    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.

    Code:
    
    Environment           : 
    Account               : 
    TenantId              : 
    SubscriptionId        : 
    SubscriptionName      : 
    CurrentStorageAccount : 
    PSComputerName        : localhost
    I even tried saving the context outside the workflow and tried to use the context but got the error.
    Code:
    # Setup – First login manually 
    Add-AzureRmAccount 
    
    # Now save your context locally (Force will overwrite if there) 
        $ContextLocation=C:\Context\test
     
    $path = "$ContextLocation\ProfileContext.ctx"
    Save-AzureRmContext -Path $path -Force 
    
    #Once that’s done, from then on you can use the Import-AzureRmContext to automate the login.
    
    
    # Once the above two steps are done, you can simply import  
    Import-AzureRmContext -Path $path 
    
    I got this error:
    Run Login-AzureRmAccount to login.
        + CategoryInfo          : InvalidOperation: (:) [Remove-AzureRmResourceGroup], PSInvalidOperationException
        + FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.Resources.RemoveAzureResourceGroupCmdlet
        + PSComputerName        : [localhost]
    How can i get this to return the subscription info using powershell workflow? Could someone help please.
    Last edited by jonathan184; Aug 28 '17, 02:43 PM. Reason: To add additional info
Working...