Azure / Azure/azure-powershell
Get-AzPrivateEndpointConnection: Microsoft.Sql/managedInstances doesn't support private endpoint connection.
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
Hi,
I'm trying to retrieve the list of private endpoints that belongs to an Azure SQL Managed Instance.
To achieve that, I'm using the cmdlet `Get-AzPrivateEndpointConnection`:
`Get-AzPrivateEndpointConnection -PrivateLinkResourceId '/subscriptions/MySubscription/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/managedInstances/MyManagedInstance'`
The cmdlet is returning an error:
`Get-AzPrivateEndpointConnection: Microsoft.Sql/managedInstances doesn't support private endpoint connection.`
However, SQL MI supports Private endpoint since [early 2023.](https://techcommunity.microsoft.com/blog/azuresqlblog/private-endpoints-for-azure-sql-managed-instance/3782015)
Also, the list of private endpoints that belongs to an Azure SQL Managed Instance is retrievable through the [REST API.](https://learn.microsoft.com/en-us/rest/api/sql/managed-instance-private-endpoint-connections/list-by-managed-instance
)
So there is probably an update needed to the cmdlet `Get-AzPrivateEndpointConnection` to add the support of SQL Managed Instance.
In the mean time, I'll use the REST API to cover my use case.
Thank you for your support and feedback.
### Issue script & Debug output
```PowerShell
PS C:\Users\xxx> $DebugPreference='Continue'
PS C:\Users\xxx> Get-AzPrivateEndpointConnection -PrivateLinkResourceId '/subscriptions/MySubscription/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/managedInstances/MyManagedInstance'
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:39:40 - GetAzurePrivateEndpointConnection begin processing with ParameterSet 'ByPrivateLinkResourceId'.
DEBUG: 09:39:40 - using account id 'xxx'...
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Network], Cmdlet = [Get-AzPrivateEndpointConnection]. Returning default value [True].
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [Az.Network], Cmdlet = [Get-AzPrivateEndpointConnection]. Returning default value [False].
Get-AzPrivateEndpointConnection: Microsoft.Sql/managedInstances doesn't support private endpoint connection.
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Network], Cmdlet = [Get-AzPrivateEndpointConnection]. Returning default value [True].
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Network:7.12.0; CommandName: Get-AzPrivateEndpointConnection; PSVersion: 7.5.0; IsSuccess: False; Duration: 00:00:00.0202729; SanitizeDuration: 00:00:00; Exception: Microsoft.Sql/managedInstances doesn't support private endpoint connection.;
DEBUG: 09:39:40 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:39:40 - GetAzurePrivateEndpointConnection end processing.
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 13.1.0 Az Core,Desk
Script 4.0.2 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzCo…
Script 2.1.0 Az.Advisor Core,Desk {Disable-AzAdvisorRecommendation, Enabl…
Script 6.1.0 Az.Aks Core,Desk {Disable-AzAksAddOn, Enable-AzAksAddOn,…
Script 1.2.0 Az.AnalysisServices Core,Desk {Add-AzAnalysisServicesAccount, Export-…
Script 4.1.0 Az.ApiManagement Core,Desk {Add-AzApiManagementApiToGateway, Add-A…
Script 2.0.1 Az.App Core,Desk {Disable-AzContainerAppRevision, Enable…
Script 1.4.0 Az.AppConfiguration Core,Desk {Clear-AzAppConfigurationDeletedStore, …
Script 2.3.0 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, Get-AzAppli…
Script 1.1.0 Az.ArcResourceBridge Core,Desk {Get-AzArcResourceBridge, Get-AzArcReso…
Script 2.1.0 Az.Attestation Core,Desk {Add-AzAttestationPolicySigner, Get-AzA…
Script 1.1.0 Az.Automanage Core,Desk {Get-AzAutomanageBestPractice, Get-AzAu…
Script 1.11.0 Az.Automation Core,Desk {Export-AzAutomationDscConfiguration, E…
Script 3.7.0 Az.Batch Core,Desk {Disable-AzBatchAutoScale, Disable-AzBa…
Script 2.2.0 Az.Billing Core,Desk {Get-AzBillingAccount, Get-AzBillingInv…
Script 3.3.0 Az.Cdn Core,Desk {Clear-AzCdnEndpointContent, Clear-AzFr…
Script 2.1.0 Az.CloudService Core,Desk {Get-AzCloudService, Get-AzCloudService…
Script 1.15.0 Az.CognitiveServices Core,Desk {Add-AzCognitiveServicesAccountNetworkR…
Script 9.0.1 Az.Compute Core,Desk {Add-AzImageDataDisk, Add-AzVhd, Add-Az…
Script 1.1.0 Az.ConfidentialLedger Core,Desk {Get-AzConfidentialLedger, New-AzConfid…
Script 1.1.1 Az.ConnectedMachine Core,Desk {Connect-AzConnectedMachine, Get-AzConn…
Script 4.1.1 Az.ContainerInstance Core,Desk {Add-AzContainerInstanceOutput, Get-AzC…
Script 4.3.0 Az.ContainerRegistry Core,Desk {Connect-AzContainerRegistry, Get-AzCon…
Script 1.16.0 Az.CosmosDB Core,Desk {Get-AzCosmosDBAccount, Get-AzCosmosDBA…
Script 1.2.0 Az.DataBoxEdge Core,Desk {Get-AzDataBoxEdgeBandwidthSchedule, Ge…
Script 1.10.0 Az.Databricks Core,Desk {Get-AzDatabricksAccessConnector, Get-A…
Script 1.19.0 Az.DataFactory Core,Desk {Add-AzDataFactoryV2DataFlowDebugSessio…
Script 1.1.0 Az.DataLakeAnalytics Core,Desk {Add-AzDataLakeAnalyticsDataSource, Add…
Script 1.4.0 Az.DataLakeStore Core,Desk {Add-AzDataLakeStoreFirewallRule, Add-A…
Script 2.6.0 Az.DataProtection Core,Desk {Backup-AzDataProtectionBackupInstanceA…
Script 1.1.0 Az.DataShare Core,Desk {Get-AzDataShare, Get-AzDataShareAccoun…
Script 5.4.1 Az.DesktopVirtualization Core,Desk {Disconnect-AzWvdUserSession, Expand-Az…
Script 2.0.1 Az.DevCenter Core,Desk {Connect-AzDevCenterAdminCatalog, Conne…
Script 1.1.0 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzD…
Script 1.3.1 Az.Dns Core,Desk {Add-AzDnsRecordConfig, Get-AzDnsRecord…
Script 1.1.1 Az.DnsResolver Core,Desk {Get-AzDnsForwardingRuleset, Get-AzDnsF…
Script 1.2.1 Az.ElasticSan Core,Desk {Add-AzElasticSanVolumeGroupNetworkRule…
Script 2.2.0 Az.EventGrid Core,Desk {Disable-AzEventGridPartnerTopic, Enabl…
Script 5.1.0 Az.EventHub Core,Desk {New-AzEventHubAuthorizationRuleSASToke…
Script 1.12.0 Az.FrontDoor Core,Desk {Disable-AzFrontDoorCustomDomainHttps, …
Script 4.2.0 Az.Functions Core,Desk {Get-AzFunctionApp, Get-AzFunctionAppAv…
Script 6.3.1 Az.HDInsight Core,Desk {Add-AzHDInsightClusterIdentity, Add-Az…
Script 2.1.0 Az.HealthcareApis Core,Desk {Get-AzHealthcareApisService, Get-AzHea…
Script 1.0.0 Az.HealthDataAIServices Core,Desk {Get-AzDeidService, New-AzDeidService, …
Script 2.8.0 Az.IotHub Core,Desk {Add-AzIotHubCertificate, Add-AzIotHubC…
Script 6.3.1 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Add-AzKeyVa…
Script 2.4.0 Az.Kusto Core,Desk {Add-AzKustoClusterCalloutPolicy, Add-A…
Script 1.1.0 Az.LoadTesting Core,Desk {Get-AzLoad, New-AzLoad, Remove-AzLoad,…
Script 1.6.0 Az.LogicApp Core,Desk {Get-AzIntegrationAccount, Get-AzIntegr…
Script 1.2.0 Az.MachineLearning Core,Desk {Add-AzMlWebServiceRegionalProperty, Ex…
Script 1.2.0 Az.MachineLearningServices Core,Desk {Get-AzMLServiceQuota, Get-AzMLServiceU…
Script 1.5.0 Az.Maintenance Core,Desk {Get-AzApplyUpdate, Get-AzConfiguration…
Script 1.3.0 Az.ManagedServiceIdentity Core,Desk {Get-AzFederatedIdentityCredential, Get…
Script 3.1.0 Az.ManagedServices Core,Desk {Get-AzManagedServicesAssignment, Get-A…
Script 2.1.0 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Invoke-AzMarke…
Script 1.2.0 Az.Media Core,Desk {Get-AzMediaService, Get-AzMediaService…
Script 2.6.0 Az.Migrate Core,Desk {Get-AzMigrateDiscoveredServer, Get-AzM…
Script 6.0.1 Az.Monitor Core,Desk {Add-AzLogProfile, Add-AzMetricAlertRul…
Script 1.3.0 Az.MySql Core,Desk {Get-AzMySqlConfiguration, Get-AzMySqlC…
Script 7.12.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthentication…
Script 1.1.0 Az.NetworkCloud Core,Desk {Deploy-AzNetworkCloudCluster, Disable-…
Script 1.2.0 Az.Nginx Core,Desk {Get-AzNginxCertificate, Get-AzNginxCon…
Script 1.2.0 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificat…
Script 3.3.0 Az.OperationalInsights Core,Desk {Disable-AzOperationalInsightsIISLogCol…
Script 1.1.0 Az.Oracle Core,Desk {Add-AzOracleCloudVMClusterVM, Get-AzOr…
Script 1.7.0 Az.PolicyInsights Core,Desk {Get-AzPolicyAttestation, Get-AzPolicyE…
Script 1.2.0 Az.PostgreSql Core,Desk {Get-AzPostgreSqlConfiguration, Get-AzP…
Script 2.1.0 Az.PowerBIEmbedded Core,Desk {Get-AzPowerBIEmbeddedCapacity, New-AzP…
Script 1.2.0 Az.PrivateDns Core,Desk {Add-AzPrivateDnsRecordConfig, Get-AzPr…
Script 7.4.0 Az.RecoveryServices Core,Desk {Add-AzRecoveryServicesAsrReplicationPr…
Script 1.11.0 Az.RedisCache Core,Desk {Export-AzRedisCache, Get-AzRedisCache,…
Script 1.2.1 Az.RedisEnterpriseCache Core,Desk {Export-AzRedisEnterpriseCache, Get-AzR…
Script 2.1.0 Az.Relay Core,Desk {Get-AzRelayAuthorizationRule, Get-AzRe…
Script 1.1.0 Az.ResourceGraph Core,Desk {Search-AzGraph, Get-AzResourceGraphQue…
Script 1.3.0 Az.ResourceMover Core,Desk {Add-AzResourceMoverMoveResource, Get-A…
Script 7.8.0 Az.Resources Core,Desk {Export-AzResourceGroup, Export-AzTempl…
Script 1.8.0 Az.Security Core,Desk {Add-AzSecurityAdaptiveNetworkHardening…
Script 3.2.0 Az.SecurityInsights Core,Desk {Get-AzSentinelAlertRule, Get-AzSentine…
Script 4.1.0 Az.ServiceBus Core,Desk {New-AzServiceBusAuthorizationRuleSASTo…
Script 3.5.0 Az.ServiceFabric Core,Desk {Add-AzServiceFabricClientCertificate, …
Script 2.1.0 Az.SignalR Core,Desk {Get-AzSignalR, Get-AzSignalRKey, Get-A…
Script 6.0.1 Az.Sql Core,Desk {Add-AzSqlDatabaseToFailoverGroup, Add-…
Script 2.4.0 Az.SqlVirtualMachine Core,Desk {Assert-AzSqlVMEntraAuth, Get-AzAvailab…
Script 2.5.0 Az.StackHCI Core,Desk {Add-AzStackHCIVMAttestation, Disable-A…
Script 1.1.0 Az.StackHCIVM Core,Desk {Add-AzStackHCIVMVirtualMachineDataDisk…
Script 8.1.0 Az.Storage Core,Desk {Add-AzRmStorageContainerLegalHold, Add…
Script 1.5.0 Az.StorageMover Core,Desk {Get-AzStorageMover, Get-AzStorageMover…
Script 2.4.0 Az.StorageSync Core,Desk {Get-AzStorageSyncCloudEndpoint, Get-Az…
Script 2.1.0 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsCluster, Get-AzSt…
Script 2.1.0 Az.Support Core,Desk {Get-AzSupportChatTranscript, Get-AzSup…
Script 3.1.0 Az.Synapse Core,Desk {Add-AzSynapseDataFlowDebugSessionPacka…
Script 1.3.0 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndp…
Script 3.3.0 Az.Websites Core,Desk {Add-AzWebAppAccessRestrictionRule, Add…
```
### Error output
```PowerShell
Message : Microsoft.Sql/managedInstances doesn't support private endpoint connection.
StackTrace : at Microsoft.Azure.Commands.Network.PrivateEndpointConnectionBaseCmdlet.BuildProvider(String
subscription, String privateLinkResourceType)
at Microsoft.Azure.Commands.Network.GetAzurePrivateEndpointConnection.Execute()
at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.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 : Microsoft.Azure.Commands.Common.Exceptions.AzPSApplicationException
InvocationInfo : {Get-AzPrivateEndpointConnection}
Line : Get-AzPrivateEndpointConnection -PrivateLinkResourceId '/subscriptions/MySubscription/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/managedInstances/MyManagedInstance'
Position : At line:1 char:1
+ Get-AzPrivateEndpointConnection -PrivateLinkResourceId '/subscription …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 9
```
Contributor guide
Research direction
Start by reproducing Get-AzPrivateEndpointConnection with the Microsoft.Sql/managedInstances resource ID and compare its behavior with the documented managed-instance private endpoint connections REST API. Done means the cmdlet retrieves the private endpoint connections for an Azure SQL Managed Instance instead of reporting that the resource type is unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100