Skip to content

Commit

Permalink
Log exceptions that occurs in Initialize-AzModule (#20528)
Browse files Browse the repository at this point in the history
* Log exceptions that occurs in Initialize-AzModule

* Bump up version, add generated files
  • Loading branch information
onetocny authored Oct 9, 2024
1 parent ee86531 commit 543e5fc
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 19 deletions.
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"
}
}

0 comments on commit 543e5fc

Please sign in to comment.