Azure / Azure/bicep-types-az

Azure sql Failover groups 2nd time run fails on readonly Endpoint

Open
#2,153 4 comments 0 reactions 0 assignees View on GitHub
Service Attention SQL
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

Hi,

I setup a very basic sql failover group. The very first round of running bicep runs as expectd. Without any changes, the 2nd round fails.

Errors like below:

"code":"FailoverGroupCreateOrUpdateRequestInvalidReadOnlyEndpointTargetServer","message":"The property targetServer of the read-only endpoint must be a valid server present among the partner Servers configured for the failover group."

Others report the same issues on stackoverflow. The solution the put on does not work for me.
https://stackoverflow.com/questions/78337117/azure-sql-failover-group-fails-on-second-run

Thanks
.

```bicep
param owsSqlname string
param owsSql2name string
param environment string

resource sqlPrimary 'Microsoft.Sql/servers@2023-05-01-preview' existing = {
name: sqlname
}

resource sqlSecondary 'Microsoft.Sql/servers@2023-05-01-preview' existing = {
name: sql2name
}

resource sqlfailover 'Microsoft.Sql/servers/failoverGroups@2023-05-01-preview' = {
name: 'nz-sql-${environment}-failover-01'
parent: sqlPrimary
properties: {
partnerServers: [
{
id: resourceId(resourceGroup().name, 'Microsoft.Sql/servers', sql2name)
}
]
readWriteEndpoint: {
failoverPolicy: 'Automatic'
failoverWithDataLossGracePeriodMinutes: 60
}
readOnlyEndpoint: {
failoverPolicy: 'Disabled'
targetServer: resourceId(resourceGroup().name, 'Microsoft.Sql/servers', sql2name)
}
secondaryType: 'Standby'
}
dependsOn: [
sqlSecondary
]
}
```

**Bicep version**
run `bicep --version` via the Bicep CLI, `az bicep version` via the AZ CLI or via VS code by navigating to the extensions tab and searching for Bicep

**Describe the bug**
A clear and concise description of what the bug is vs what you expected to happen

**To Reproduce**
Steps to reproduce the behavior:

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no repository file or test. Start by reproducing the second deployment with the supplied Bicep failover-group definition and checking the Bicep version with one of the listed CLI commands. Done means determining whether the generated resource definition or the Azure SQL API rejects the read-only endpoint on the second run, then documenting an actionable fix or limitation.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.