0

二头肌版

二头肌 CLI 版本 0.3.255 (589f037)

描述错误

我正在尝试通过二头肌为 PostgreSQL 服务器设置 Active Directory 管理员。我能够创建 PostgreSQL 服务器,但没有关于例如类型的文档resource postgresqlActiveDirectoryAdmin 'Microsoft.DBforPostgreSQL/servers/administrators@2017-12-01'。所以我决定导出一个手动设置管理员的资源的 ARM 模板,并将其反编译为二头肌模板。

被抛出的错误是一个错误的请求

{
    "status": "Failed",
    "error": {
        "code": "InvalidResourceIdSegment",
        "message": "The 'parameters.properties' segment in the url is invalid.",
        "details": [
            {
                "code": "InvalidResourceIdSegment",
                "target": "parameters.properties",
                "message": ""
            }
        ]
    }
}

重现 只需在 Bicep 中创建 PostgreSQL 服务器并尝试添加管理员,例如:

resource postgreSQL 'Microsoft.DBforPostgreSQL/servers@2017-12-01' = {
  name: serverName
  identity: {
    type: 'SystemAssigned'
  }
  sku: {
    name: 'B_Gen5_1'
    tier: 'Basic'
    capacity: 1
    family: 'Gen5'
  }
  properties: {
    version: '11'
    sslEnforcement: 'Enabled'
    minimalTlsVersion: 'TLSEnforcementDisabled'
    infrastructureEncryption: 'Disabled'
    publicNetworkAccess: 'Enabled'
    storageProfile: {
      backupRetentionDays: 7
      geoRedundantBackup: 'Disabled'
      storageMB: 5120
      storageAutogrow: 'Disabled'
    }
    createMode: 'Default'
    administratorLogin: 'adminName'
    administratorLoginPassword: 's3cur3p455w0rd!' 
  }
  location: 'uksouth'
  tags: {}
  //resources: [] 
}


resource postgresqlActiveDirectoryAdmin 'Microsoft.DBforPostgreSQL/servers/administrators@2017-12-01' = {
  parent: postgreSQL
  name: 'activeDirectory'
  properties: {
    administratorType: 'ActiveDirectory'
    login: 'PostgresAdmin' //This is a Group in the Azure Directory
    sid: 'xxxxxxx' //grab SID(object id) of the group
    tenantId: 'xxxx' //tenant id
  }
}

文档中没有真正提到,所以只是依靠一些关于目前是否可行的知识?

4

1 回答 1

0

这对我来说是可能的并且工作得很好(即使部署大约需要 10 分钟):

param serverName string

resource postgreSQL 'Microsoft.DBforPostgreSQL/servers@2017-12-01' existing = {
  name:serverName
}

resource postgresqlActiveDirectoryAdmin 'Microsoft.DBforPostgreSQL/servers/administrators@2017-12-01' = {
  name: '${postgreSQL.name}/ActiveDirectory'
  properties: {
    administratorType: 'ActiveDirectory'
    login: 'PostgresAdmin' //This is a Group in the Azure Directory
    sid: 'xxxxxxx' //grab SID(object id) of the group
    tenantId: 'xxxx' //tenant id
  }
}

于 2021-08-24T07:35:04.207 回答