Approving managed private endpoint for SQL times out
- Dominant language
- TypeScript
- Stars
- 108
- Forks
- 44
- Avg merge
- 18h 53m
- Merged PRs (30d)
- 29
Description
**Bicep version**
v0.24.24
**Describe the bug**
When approving a private endpoint connection on Azure SQL server for a Data Factory managed private endpoint the command successfully approves the connection, Data Factory also shows the connection state as approved but the command never exits resulting in a timeout.
**To Reproduce**
create a managed private endpoint for Azure SQL in Data Factory.
use a module to get the SQL private endpoint connections:
```bicep
param sqlServerName string
resource sqlServer 'Microsoft.Sql/servers@2023-05-01-preview' existing = {
name: sqlServerName
}
module approveEndpoint 'module.privateEndpointConnections.bicep' = {
name: 'approve-sql-endpoint'
params: {
endpointArray: sqlServer.properties.privateEndpointConnections
sqlServerName: sqlServer.name
}
}
```
use a second module to read the connection info and approve
```bicep
param endpointArray array
param sqlServerName string
resource sqlServer 'Microsoft.Sql/servers@2023-05-01-preview' existing = {
name: sqlServerName
}
var privateEndpoint = [for pep in endpointArray: {
status: pep.properties.privateLinkServiceConnectionState.status
name: last(split(pep.id, '/'))
}
]
resource privateEndpointConnection 'Microsoft.Sql/servers/privateEndpointConnections@2023-05-01-preview' = [for endpoint in privateEndpoint: if (endpoint.status != 'Approved') {
name: endpoint.name
parent: sqlServer
properties: {
privateLinkServiceConnectionState: {
status: 'Approved'
description: 'Approved by pipeline'
}
}
}]
resource privateEndpointConnection 'Microsoft.Sql/servers/privateEndpointConnections@2023-05-01-preview' = [for endpoint in privateEndpoint: if (endpoint.status != 'Approved') {
name: endpoint.name
parent: sqlServer
properties: {
privateLinkServiceConnectionState: {
status: 'Approved'
description: 'Approved by pipeline'
}
}
}]
```
use az cli to deploy the template:
`az deployment group create -g $resourceGroup -n $name -f $bicepFile`
I have tested hard coding the endpoint name which results in the same deployment error:
`"The resource provision operation did not complete within the allowed timeout period.". `
For reference this is the storage account code which works:
module to get the private endpoint connections:
```bicep
param storageAccountName string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' existing = {
name: storageAccountName
}
module approveEndpoint 'module.privateEndpointConnections.bicep' = {
name: 'approve-storage-endpoint'
params: {
endpointArray: storageAccount.properties.privateEndpointConnections
storageAccountName: storageAccount.name
}
}
```
use a second module to read the connection info and approve
```bicep
param endpointArray array
param storageAccountName string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' existing = {
name: storageAccountName
}
var privateEndpoint = [for pep in endpointArray: {
status: pep.properties.privateLinkServiceConnectionState.status
name: pep.name
}
]
resource privateEndpointConnection 'Microsoft.Storage/storageAccounts/privateEndpointConnections@2023-01-01' = [for endpoint in privateEndpoint : if(endpoint.status != 'Approved') {
name: endpoint.name
parent: storageAccount
properties: {
privateLinkServiceConnectionState: {
status: 'Approved'
description: 'Approved by pipeline'
}
}
}]
```
I did notice the output for storage private endpoint connections contains a name property which is not in the sql output.
**Additional context**
If I use cli `az network private-endpoint-connection approve` this works fine.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the two module.privateEndpointConnections.bicep examples and compare the SQL and storage resource definitions, especially the endpoint name values. Reproduce the SQL deployment with az deployment group create and compare it with az network private-endpoint-connection approve. Done means the SQL connection is approved and the deployment exits successfully without timing out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, sql
- Domain
- cloud, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100