@@ -55,8 +55,6 @@ function Test-AzDoServiceConnection {
5555 ServiceConnectionName = $ServiceConnectionName
5656 }
5757
58- $Connections = Get-AzDoServiceConnection @getAzDoServiceConnectionSplat
59-
6058 $connectioninfo = Get-AzDoServiceConnection @getAzDoServiceConnectionSplat
6159
6260 $body = @ {
@@ -67,22 +65,22 @@ function Test-AzDoServiceConnection {
6765 }
6866
6967 $params = @ {
70- uri = " $CollectionUri /$ProjectName /_apis/serviceendpoint/endpointproxy?endpointId= $ ( $connectioninfo .ServiceConnectionId ) &api-version=7.2-preview.1 "
71- Method = ' POST '
72- Headers = $ script :header
73- body = $Body | ConvertTo-Json - Depth 99
74- ContentType = ' application/json '
68+ uri = " $CollectionUri /$ProjectName /_apis/serviceendpoint/endpointproxy"
69+ version = " 7.2-preview.1 "
70+ queryParameters = " endpointId= $ ( $connectioninfo .ServiceConnectionId ) "
71+ method = ' POST '
72+ body = $body
7573 }
7674
7775 if ($PSCmdlet.ShouldProcess ($ProjectName , " Test service connection on: $ ( $PSStyle.Bold ) $ProjectName $ ( $PSStyle.Reset ) " )) {
78- $result = Invoke-RestMethod @Params
79- if ($response .statusCode -eq ' badRequest' ) {
80- Write-Error " Connection $ ( $connectioninfo.ServiceConnectionName ) is not working: error $ ( $response .errorMessage ) "
76+ $result = Invoke-AzDoRestMethod @params
77+ if ($result .statusCode -eq ' badRequest' ) {
78+ Write-Error " Connection $ ( $connectioninfo.ServiceConnectionName ) is not working: error $ ( $result .errorMessage ) "
8179 } else {
8280 [PSCustomObject ]@ {
8381 Result = " Connection [$ ( $connectioninfo.ServiceConnectionName ) ] is working as expected"
8482 }
85- Write-Verbose ($response .result | ConvertFrom-Json - Depth 10 | ConvertTo-Json - Depth 10 - Compress)
83+ Write-Verbose ($result .result | ConvertFrom-Json - Depth 10 | ConvertTo-Json - Depth 10 - Compress)
8684 }
8785 }
8886 }
0 commit comments