Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log exceptions that occurs in Initialize-AzModule #20528

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Tasks/AzurePowerShellV5/CoreAz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ Update-PSModulePathForHostedAgent -targetAzurePs $targetAzurePs
$endpointObject = ConvertFrom-Json $endpoint
Import-Module "$PSScriptRoot\ps_modules\VstsAzureHelpers_"
$encryptedToken = ConvertTo-SecureString $vstsAccessToken -AsPlainText -Force
Initialize-AzModule -Endpoint $endpointObject -connectedServiceNameARM $connectedServiceNameARM `

try {
Initialize-AzModule -Endpoint $endpointObject -connectedServiceNameARM $connectedServiceNameARM `
-azVersion $targetAzurePs -isPSCore $isPSCore -encryptedToken $encryptedToken
}
catch {
Write-Host "An error occurred in Initialize-AzModule"
Resolve-Error $_ | ConvertTo-Json -Depth 5 | Write-Host
throw
}

if ($vstsAccessToken) {
$env:AZURESUBSCRIPTION_SERVICE_CONNECTION_ID = $connectedServiceNameARM
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV5/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 5,
"Minor": 247,
"Patch": 0
"Patch": 2
},
"releaseNotes": "Added support for Az Module and cross platform agents.",
"groups": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV5/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 5,
"Minor": 247,
"Patch": 0
"Patch": 2
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"groups": [
Expand Down
4 changes: 2 additions & 2 deletions _generated/AzurePowerShellV5.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|5.247.0
Node20_229_2|5.247.1
Default|5.247.2
Node20_229_2|5.247.3
10 changes: 9 additions & 1 deletion _generated/AzurePowerShellV5/CoreAz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ Update-PSModulePathForHostedAgent -targetAzurePs $targetAzurePs
$endpointObject = ConvertFrom-Json $endpoint
Import-Module "$PSScriptRoot\ps_modules\VstsAzureHelpers_"
$encryptedToken = ConvertTo-SecureString $vstsAccessToken -AsPlainText -Force
Initialize-AzModule -Endpoint $endpointObject -connectedServiceNameARM $connectedServiceNameARM `

try {
Initialize-AzModule -Endpoint $endpointObject -connectedServiceNameARM $connectedServiceNameARM `
-azVersion $targetAzurePs -isPSCore $isPSCore -encryptedToken $encryptedToken
}
catch {
Write-Host "An error occurred in Initialize-AzModule"
Resolve-Error $_ | ConvertTo-Json -Depth 5 | Write-Host
throw
}

if ($vstsAccessToken) {
$env:AZURESUBSCRIPTION_SERVICE_CONNECTION_ID = $connectedServiceNameARM
Expand Down
6 changes: 3 additions & 3 deletions _generated/AzurePowerShellV5/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 5,
"Minor": 247,
"Patch": 0
"Patch": 2
},
"releaseNotes": "Added support for Az Module and cross platform agents.",
"groups": [
Expand Down Expand Up @@ -204,7 +204,7 @@
"PS_ExitCode": "PowerShell exited with code '{0}'."
},
"_buildConfigMapping": {
"Default": "5.247.0",
"Node20_229_2": "5.247.1"
"Default": "5.247.2",
"Node20_229_2": "5.247.3"
}
}
6 changes: 3 additions & 3 deletions _generated/AzurePowerShellV5/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 5,
"Minor": 247,
"Patch": 0
"Patch": 2
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"groups": [
Expand Down Expand Up @@ -204,7 +204,7 @@
"PS_ExitCode": "ms-resource:loc.messages.PS_ExitCode"
},
"_buildConfigMapping": {
"Default": "5.247.0",
"Node20_229_2": "5.247.1"
"Default": "5.247.2",
"Node20_229_2": "5.247.3"
}
}
10 changes: 9 additions & 1 deletion _generated/AzurePowerShellV5_Node20/CoreAz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ Update-PSModulePathForHostedAgent -targetAzurePs $targetAzurePs
$endpointObject = ConvertFrom-Json $endpoint
Import-Module "$PSScriptRoot\ps_modules\VstsAzureHelpers_"
$encryptedToken = ConvertTo-SecureString $vstsAccessToken -AsPlainText -Force
Initialize-AzModule -Endpoint $endpointObject -connectedServiceNameARM $connectedServiceNameARM `

try {
Initialize-AzModule -Endpoint $endpointObject -connectedServiceNameARM $connectedServiceNameARM `
-azVersion $targetAzurePs -isPSCore $isPSCore -encryptedToken $encryptedToken
}
catch {
Write-Host "An error occurred in Initialize-AzModule"
Resolve-Error $_ | ConvertTo-Json -Depth 5 | Write-Host
throw
}

if ($vstsAccessToken) {
$env:AZURESUBSCRIPTION_SERVICE_CONNECTION_ID = $connectedServiceNameARM
Expand Down
6 changes: 3 additions & 3 deletions _generated/AzurePowerShellV5_Node20/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 5,
"Minor": 247,
"Patch": 1
"Patch": 3
},
"releaseNotes": "Added support for Az Module and cross platform agents.",
"groups": [
Expand Down Expand Up @@ -208,7 +208,7 @@
"PS_ExitCode": "PowerShell exited with code '{0}'."
},
"_buildConfigMapping": {
"Default": "5.247.0",
"Node20_229_2": "5.247.1"
"Default": "5.247.2",
"Node20_229_2": "5.247.3"
}
}
6 changes: 3 additions & 3 deletions _generated/AzurePowerShellV5_Node20/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 5,
"Minor": 247,
"Patch": 1
"Patch": 3
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"groups": [
Expand Down Expand Up @@ -208,7 +208,7 @@
"PS_ExitCode": "ms-resource:loc.messages.PS_ExitCode"
},
"_buildConfigMapping": {
"Default": "5.247.0",
"Node20_229_2": "5.247.1"
"Default": "5.247.2",
"Node20_229_2": "5.247.3"
}
}