azure.postgresql.FlexibleServerActiveDirectoryAdministrator

Explore with Pulumi AI

Allows you to set a user or group as the AD administrator for a PostgreSQL Flexible Server.

Example Usage

Coming soon!

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azuread.ServicePrincipal;
import com.pulumi.azuread.ServicePrincipalArgs;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.postgresql.FlexibleServer;
import com.pulumi.azure.postgresql.FlexibleServerArgs;
import com.pulumi.azure.postgresql.inputs.FlexibleServerAuthenticationArgs;
import com.pulumi.azure.postgresql.FlexibleServerActiveDirectoryAdministrator;
import com.pulumi.azure.postgresql.FlexibleServerActiveDirectoryAdministratorArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = CoreFunctions.getClientConfig();

        var postgresql = new ServicePrincipal("postgresql", ServicePrincipalArgs.builder()        
            .applicationId("5657e26c-cc92-45d9-bc47-9da6cfdb4ed9")
            .useExisting(true)
            .build());

        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleFlexibleServer = new FlexibleServer("exampleFlexibleServer", FlexibleServerArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .location(exampleResourceGroup.location())
            .version("12")
            .administratorLogin("4dm1n157r470r")
            .administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
            .skuName("GP_Standard_D2s_v3")
            .zone("2")
            .authentication(FlexibleServerAuthenticationArgs.builder()
                .activeDirectoryAuthEnabled(true)
                .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(postgresql)
                .build());

        var exampleFlexibleServerActiveDirectoryAdministrator = new FlexibleServerActiveDirectoryAdministrator("exampleFlexibleServerActiveDirectoryAdministrator", FlexibleServerActiveDirectoryAdministratorArgs.builder()        
            .serverName(azurerm_postgresql_server.example().name())
            .resourceGroupName(exampleResourceGroup.name())
            .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
            .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
            .principalName("example-sp")
            .principalType("ServicePrincipal")
            .build());

    }
}

Coming soon!

Coming soon!

resources:
  postgresql:
    type: azuread:ServicePrincipal
    properties:
      applicationId: 5657e26c-cc92-45d9-bc47-9da6cfdb4ed9
      useExisting: true
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleFlexibleServer:
    type: azure:postgresql:FlexibleServer
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
      version: '12'
      administratorLogin: 4dm1n157r470r
      administratorLoginPassword: 4-v3ry-53cr37-p455w0rd
      skuName: GP_Standard_D2s_v3
      zone: '2'
      authentication:
        activeDirectoryAuthEnabled: true
        tenantId: ${current.tenantId}
    options:
      dependson:
        - ${postgresql}
  exampleFlexibleServerActiveDirectoryAdministrator:
    type: azure:postgresql:FlexibleServerActiveDirectoryAdministrator
    properties:
      serverName: ${azurerm_postgresql_server.example.name}
      resourceGroupName: ${exampleResourceGroup.name}
      tenantId: ${current.tenantId}
      objectId: ${current.objectId}
      principalName: example-sp
      principalType: ServicePrincipal
variables:
  current:
    fn::invoke:
      Function: azure:core:getClientConfig
      Arguments: {}

Create FlexibleServerActiveDirectoryAdministrator Resource

new FlexibleServerActiveDirectoryAdministrator(name: string, args: FlexibleServerActiveDirectoryAdministratorArgs, opts?: CustomResourceOptions);
@overload
def FlexibleServerActiveDirectoryAdministrator(resource_name: str,
                                               opts: Optional[ResourceOptions] = None,
                                               object_id: Optional[str] = None,
                                               principal_name: Optional[str] = None,
                                               principal_type: Optional[str] = None,
                                               resource_group_name: Optional[str] = None,
                                               server_name: Optional[str] = None,
                                               tenant_id: Optional[str] = None)
@overload
def FlexibleServerActiveDirectoryAdministrator(resource_name: str,
                                               args: FlexibleServerActiveDirectoryAdministratorArgs,
                                               opts: Optional[ResourceOptions] = None)
func NewFlexibleServerActiveDirectoryAdministrator(ctx *Context, name string, args FlexibleServerActiveDirectoryAdministratorArgs, opts ...ResourceOption) (*FlexibleServerActiveDirectoryAdministrator, error)
public FlexibleServerActiveDirectoryAdministrator(string name, FlexibleServerActiveDirectoryAdministratorArgs args, CustomResourceOptions? opts = null)
public FlexibleServerActiveDirectoryAdministrator(String name, FlexibleServerActiveDirectoryAdministratorArgs args)
public FlexibleServerActiveDirectoryAdministrator(String name, FlexibleServerActiveDirectoryAdministratorArgs args, CustomResourceOptions options)
type: azure:postgresql:FlexibleServerActiveDirectoryAdministrator
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FlexibleServerActiveDirectoryAdministratorArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FlexibleServerActiveDirectoryAdministratorArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FlexibleServerActiveDirectoryAdministratorArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FlexibleServerActiveDirectoryAdministratorArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FlexibleServerActiveDirectoryAdministratorArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

FlexibleServerActiveDirectoryAdministrator Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The FlexibleServerActiveDirectoryAdministrator resource accepts the following input properties:

ObjectId string

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

PrincipalName string

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

PrincipalType string

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

ServerName string

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

TenantId string

The Azure Tenant ID. Changing this forces a new resource to be created.

ObjectId string

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

PrincipalName string

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

PrincipalType string

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

ServerName string

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

TenantId string

The Azure Tenant ID. Changing this forces a new resource to be created.

objectId String

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principalName String

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principalType String

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

serverName String

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenantId String

The Azure Tenant ID. Changing this forces a new resource to be created.

objectId string

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principalName string

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principalType string

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

serverName string

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenantId string

The Azure Tenant ID. Changing this forces a new resource to be created.

object_id str

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principal_name str

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principal_type str

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

server_name str

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenant_id str

The Azure Tenant ID. Changing this forces a new resource to be created.

objectId String

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principalName String

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principalType String

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

serverName String

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenantId String

The Azure Tenant ID. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the FlexibleServerActiveDirectoryAdministrator resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing FlexibleServerActiveDirectoryAdministrator Resource

Get an existing FlexibleServerActiveDirectoryAdministrator resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FlexibleServerActiveDirectoryAdministratorState, opts?: CustomResourceOptions): FlexibleServerActiveDirectoryAdministrator
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        object_id: Optional[str] = None,
        principal_name: Optional[str] = None,
        principal_type: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        server_name: Optional[str] = None,
        tenant_id: Optional[str] = None) -> FlexibleServerActiveDirectoryAdministrator
func GetFlexibleServerActiveDirectoryAdministrator(ctx *Context, name string, id IDInput, state *FlexibleServerActiveDirectoryAdministratorState, opts ...ResourceOption) (*FlexibleServerActiveDirectoryAdministrator, error)
public static FlexibleServerActiveDirectoryAdministrator Get(string name, Input<string> id, FlexibleServerActiveDirectoryAdministratorState? state, CustomResourceOptions? opts = null)
public static FlexibleServerActiveDirectoryAdministrator get(String name, Output<String> id, FlexibleServerActiveDirectoryAdministratorState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ObjectId string

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

PrincipalName string

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

PrincipalType string

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

ServerName string

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

TenantId string

The Azure Tenant ID. Changing this forces a new resource to be created.

ObjectId string

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

PrincipalName string

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

PrincipalType string

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

ServerName string

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

TenantId string

The Azure Tenant ID. Changing this forces a new resource to be created.

objectId String

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principalName String

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principalType String

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

serverName String

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenantId String

The Azure Tenant ID. Changing this forces a new resource to be created.

objectId string

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principalName string

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principalType string

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

serverName string

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenantId string

The Azure Tenant ID. Changing this forces a new resource to be created.

object_id str

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principal_name str

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principal_type str

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

server_name str

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenant_id str

The Azure Tenant ID. Changing this forces a new resource to be created.

objectId String

The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created.

principalName String

The name of Azure Active Directory principal. Changing this forces a new resource to be created.

principalType String

The type of Azure Active Directory principal. Possible values are Group, ServicePrincipal and User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created.

serverName String

The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created.

tenantId String

The Azure Tenant ID. Changing this forces a new resource to be created.

Import

A PostgreSQL Flexible Server Active Directory Administrator can be imported using the resource id, e.g.

 $ pulumi import azure:postgresql/flexibleServerActiveDirectoryAdministrator:FlexibleServerActiveDirectoryAdministrator example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/myserver/administrators/objectId

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.