Skip to content

Conversation

@isra-fel
Copy link
Member

@isra-fel isra-fel commented May 14, 2020

@isra-fel isra-fel changed the title another way to call powershell Change the way we call powershell in AzurePSCmdlet May 14, 2020
@isra-fel isra-fel requested a review from dingmeng-xue May 15, 2020 02:50
@isra-fel isra-fel assigned 04diiguyi and dingmeng-xue and unassigned 04diiguyi May 15, 2020
@isra-fel
Copy link
Member Author

Dingmeng, I've tested it in a local build and it works.

@isra-fel isra-fel force-pushed the yeming-debug-log branch from 20665a0 to 32e20db Compare May 15, 2020 08:02
@Azure Azure deleted a comment from dingmeng-xue May 15, 2020
@isra-fel
Copy link
Member Author

Tested. It works perfectly:

C:\Users\yeliu> $job = Start-Job -ScriptBlock {
>>     $DebugPreference = "Continue";
>>     Write-Debug "DEBUG - LOOK AT ME OVER HERE";
>>     $global:ErrorActionPreference = "Stop"
>>     Import-Module ~\isra-fel\azure-powershell\artifacts\Debug\Az.Accounts\
>>     Get-AzContext
>>
>>     $DebugPreference = "Continue";
>>     Write-Debug "DEBUG - LOOK AT ME DOWN HERE";
>> }

C:\Users\yeliu> $job | Wait-Job

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
1      Job1            BackgroundJob   Completed     True            localhost            …

C:\Users\yeliu> $DebugRecords = $job.ChildJobs[0].debug.readall()
C:\Users\yeliu> foreach ($r in $DebugRecords) {
>>     Write-Host $r
>> }
DEBUG - LOOK AT ME OVER HERE
Sought all Az modules and got latest version 3.8.0
4:21:24 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
4:21:24 PM - using account id 'yeliu@microsoft.com'...
AzureQoSEvent: CommandName - Get-AzContext; IsSuccess - True; Duration - 00:00:00.2392776;
Finish sending metric.
4:21:25 PM - GetAzureRMContextCommand end processing.
DEBUG - LOOK AT ME DOWN HERE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants