Azure / bicep-types-az

Bicep type definitions for ARM resources
MIT License
84 stars 27 forks source link

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

Open ltlg opened 5 months ago

ltlg commented 5 months ago

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 .

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.

microsoft-github-policy-service[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureSQLGitHub. Please see https://aka.ms/biceptypesinfo for troubleshooting help.

TheKrisSodroski commented 4 months ago

Can confirm that this happens to me as well. It makes failover groups unable to be updated programmatically.

Status Message: The property targetServer of the read-only endpoint must be a valid server present among the partnerServers configured for the failover group. (Code:FailoverGroupCreateOrUpdateRequestInvalidReadOnlyEndpointTargetServer)