【问题标题】:Setting Administrator for AAD PostgreSQL为 AAD PostgreSQL 设置管理员
【发布时间】:2021-06-08 15:19:11
【问题描述】:

二头肌版本

二头肌 CLI 版本 0.3.255 (589f037)

描述错误

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

抛出的错误是Bad Request

{
    "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
  }
}

文档中没有真正提到,所以只是依靠一些知识来了解目前这是否可能?

【问题讨论】:

    标签: postgresql azure azure-resource-manager azure-bicep


    【解决方案1】:

    这对我来说是可能的并且工作得很好(即使部署大约需要 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
      }
    }
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-25
      • 2021-01-28
      • 2012-03-23
      • 1970-01-01
      • 2021-01-17
      • 1970-01-01
      • 2023-04-04
      • 2013-08-02
      相关资源
      最近更新 更多