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

Get-AzPrivateEndpointConnection with -ResourceId throw error "Object reference not set to an instance of an object." #18104

Closed
LucasYao93 opened this issue May 11, 2022 · 2 comments
Assignees
Labels
Accounts Issues in Az.Accounts except authentication related bug This issue requires a change to an existing behavior in the product in order to be resolved.

Comments

@LucasYao93
Copy link
Contributor

LucasYao93 commented May 11, 2022

Description

if you specify the resource ID of an Azure resource that contains private endpoints that has deleted.the following error message is returned:
Object reference not set to an instance of an object.

Issue script & Debug output

Get-AzPrivateEndpointConnection -ResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/pl-rg-test/providers/Microsoft.Web/sites/webapp20220424/privateEndpointConnections/lucasprivateendpoint-2dd7aaea-da5d-458a-93b2-f265092efc8a"

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/pl-rg-test/providers/Microsoft.Web/sites/webapp20220424/privateEndpointConnections/lucasprivateendpoint-2dd7aaea-da5d-458a-93b2-f265092efc8a?api-version=2019-08-01

Headers:
x-ms-client-request-id        : c124b500-7e75-4165-8878-242992bb7368
Accept-Language               : en-US

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : 49c38784-b454-4bb8-b8a9-f3ad4cc2e954
x-ms-correlation-request-id   : 49c38784-b454-4bb8-b8a9-f3ad4cc2e954
x-ms-routing-request-id       : SOUTHEASTASIA:20220511T095047Z:49c38784-b454-4bb8-b8a9-f3ad4cc2e954
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 11 May 2022 09:50:47 GMT

Body:
{
  "error": {
    "code": "ResourceGroupNotFound",
    "message": "Resource group 'pl-rg-test' could not be found."
  }
}


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : 49c38784-b454-4bb8-b8a9-f3ad4cc2e954
x-ms-correlation-request-id   : 49c38784-b454-4bb8-b8a9-f3ad4cc2e954
x-ms-routing-request-id       : SOUTHEASTASIA:20220511T095047Z:49c38784-b454-4bb8-b8a9-f3ad4cc2e954
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 11 May 2022 09:50:47 GMT

Body:
{
  "error": {
    "code": "ResourceGroupNotFound",
    "message": "Resource group 'pl-rg-test' could not be found."
  }
}


Get-AzPrivateEndpointConnection: Object reference not set to an instance of an object.
DEBUG: AzureQoSEvent: Module: Az.Network:4.16.1; CommandName: Get-AzPrivateEndpointConnection; PSVersion: 7.1.4; IsSuccess: False; Duration: 00:00:01.9598435; Exception: Object reference not set to an instance of an object.;
DEBUG: Finish sending metric.
DEBUG: 5:50:48 PM - GetAzurePrivateEndpointConnection end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.7.4                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount…}
Script     4.15.0                Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGatewayBackendHttpSetting, Add-AzApplicationGatewayCustomError…}

Error output

DEBUG: 5:53:21 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 5:53:21 PM - using account id '[email protected]'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

   HistoryId: 2

Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Internal.Common.AzureRestOperations.BeginHttpMessagesAsync[T](HttpMethod method, String path, IDictionary`2 queries, String fragment, Object content, IDictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Internal.Common.AzureRestOperations.BeginHttpGetMessagesAsync[T](String resourceUri, String apiVersion, IDictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Internal.Common.AzureRestOperations.GetResource[T](String resourceId, String apiVersion, IDictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Commands.Network.PrivateLinkService.PrivateLinkServiceProvider.GenericProvider.GetPrivateEndpointConnection(String resourceGroupName, String serviceName, String name)
                    at Microsoft.Azure.Commands.Network.GetAzurePrivateEndpointConnection.Execute()
                    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzPrivateEndpointConnection}
Line           :  Get-AzPrivateEndpointConnection -ResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/pl-rg-test/providers/Microsoft.Web/sites/webapp20220424/privateEndpointConnections/lucasprivateendpoint-2dd7aaea-da5d-458a-93b2-f265092efc8a"
Position       : At line:1 char:2
                 +  Get-AzPrivateEndpointConnection -ResourceId "/subscriptions/9e223dbe …
                 +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: AzureQoSEvent: Module: Az.Accounts:2.7.4; CommandName: Resolve-AzError; PSVersion: 7.1.4; IsSuccess: True; Duration: 00:00:00.0663893
DEBUG: Finish sending metric.
DEBUG: 5:53:23 PM - ResolveError end processing.
@LucasYao93 LucasYao93 added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 11, 2022
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label May 11, 2022
@dingmeng-xue
Copy link
Member

@VeryEarly , this error comes from GeneralRestClient in common lib. please check the root cause.

@VeryEarly
Copy link
Collaborator

should be fixed by: Azure/azure-powershell-common#345

@dingmeng-xue dingmeng-xue added the Accounts Issues in Az.Accounts except authentication related label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accounts Issues in Az.Accounts except authentication related bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants