1. Packages
  2. Azure Classic
  3. API Docs
  4. cosmosdb
  5. PostgresqlRole

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.cosmosdb.PostgresqlRole

Explore with Pulumi AI

Manages an Azure Cosmos DB for PostgreSQL Role.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const examplePostgresqlCluster = new azure.cosmosdb.PostgresqlCluster("example", {
    name: "examplecluster",
    resourceGroupName: example.name,
    location: example.location,
    administratorLoginPassword: "H@Sh1CoR3!",
    coordinatorStorageQuotaInMb: 131072,
    coordinatorVcoreCount: 2,
    nodeCount: 0,
});
const examplePostgresqlRole = new azure.cosmosdb.PostgresqlRole("example", {
    name: "examplerole",
    clusterId: examplePostgresqlCluster.id,
    password: "H@Sh1CoR3!",
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_postgresql_cluster = azure.cosmosdb.PostgresqlCluster("example",
    name="examplecluster",
    resource_group_name=example.name,
    location=example.location,
    administrator_login_password="H@Sh1CoR3!",
    coordinator_storage_quota_in_mb=131072,
    coordinator_vcore_count=2,
    node_count=0)
example_postgresql_role = azure.cosmosdb.PostgresqlRole("example",
    name="examplerole",
    cluster_id=example_postgresql_cluster.id,
    password="H@Sh1CoR3!")
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		examplePostgresqlCluster, err := cosmosdb.NewPostgresqlCluster(ctx, "example", &cosmosdb.PostgresqlClusterArgs{
			Name:                        pulumi.String("examplecluster"),
			ResourceGroupName:           example.Name,
			Location:                    example.Location,
			AdministratorLoginPassword:  pulumi.String("H@Sh1CoR3!"),
			CoordinatorStorageQuotaInMb: pulumi.Int(131072),
			CoordinatorVcoreCount:       pulumi.Int(2),
			NodeCount:                   pulumi.Int(0),
		})
		if err != nil {
			return err
		}
		_, err = cosmosdb.NewPostgresqlRole(ctx, "example", &cosmosdb.PostgresqlRoleArgs{
			Name:      pulumi.String("examplerole"),
			ClusterId: examplePostgresqlCluster.ID(),
			Password:  pulumi.String("H@Sh1CoR3!"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resources",
        Location = "West Europe",
    });

    var examplePostgresqlCluster = new Azure.CosmosDB.PostgresqlCluster("example", new()
    {
        Name = "examplecluster",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AdministratorLoginPassword = "H@Sh1CoR3!",
        CoordinatorStorageQuotaInMb = 131072,
        CoordinatorVcoreCount = 2,
        NodeCount = 0,
    });

    var examplePostgresqlRole = new Azure.CosmosDB.PostgresqlRole("example", new()
    {
        Name = "examplerole",
        ClusterId = examplePostgresqlCluster.Id,
        Password = "H@Sh1CoR3!",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.cosmosdb.PostgresqlCluster;
import com.pulumi.azure.cosmosdb.PostgresqlClusterArgs;
import com.pulumi.azure.cosmosdb.PostgresqlRole;
import com.pulumi.azure.cosmosdb.PostgresqlRoleArgs;
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) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());

        var examplePostgresqlCluster = new PostgresqlCluster("examplePostgresqlCluster", PostgresqlClusterArgs.builder()
            .name("examplecluster")
            .resourceGroupName(example.name())
            .location(example.location())
            .administratorLoginPassword("H@Sh1CoR3!")
            .coordinatorStorageQuotaInMb(131072)
            .coordinatorVcoreCount(2)
            .nodeCount(0)
            .build());

        var examplePostgresqlRole = new PostgresqlRole("examplePostgresqlRole", PostgresqlRoleArgs.builder()
            .name("examplerole")
            .clusterId(examplePostgresqlCluster.id())
            .password("H@Sh1CoR3!")
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  examplePostgresqlCluster:
    type: azure:cosmosdb:PostgresqlCluster
    name: example
    properties:
      name: examplecluster
      resourceGroupName: ${example.name}
      location: ${example.location}
      administratorLoginPassword: H@Sh1CoR3!
      coordinatorStorageQuotaInMb: 131072
      coordinatorVcoreCount: 2
      nodeCount: 0
  examplePostgresqlRole:
    type: azure:cosmosdb:PostgresqlRole
    name: example
    properties:
      name: examplerole
      clusterId: ${examplePostgresqlCluster.id}
      password: H@Sh1CoR3!
Copy

Create PostgresqlRole Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new PostgresqlRole(name: string, args: PostgresqlRoleArgs, opts?: CustomResourceOptions);
@overload
def PostgresqlRole(resource_name: str,
                   args: PostgresqlRoleArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def PostgresqlRole(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   cluster_id: Optional[str] = None,
                   password: Optional[str] = None,
                   name: Optional[str] = None)
func NewPostgresqlRole(ctx *Context, name string, args PostgresqlRoleArgs, opts ...ResourceOption) (*PostgresqlRole, error)
public PostgresqlRole(string name, PostgresqlRoleArgs args, CustomResourceOptions? opts = null)
public PostgresqlRole(String name, PostgresqlRoleArgs args)
public PostgresqlRole(String name, PostgresqlRoleArgs args, CustomResourceOptions options)
type: azure:cosmosdb:PostgresqlRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

The following reference example uses placeholder values for all input properties.

var postgresqlRoleResource = new Azure.CosmosDB.PostgresqlRole("postgresqlRoleResource", new()
{
    ClusterId = "string",
    Password = "string",
    Name = "string",
});
Copy
example, err := cosmosdb.NewPostgresqlRole(ctx, "postgresqlRoleResource", &cosmosdb.PostgresqlRoleArgs{
	ClusterId: pulumi.String("string"),
	Password:  pulumi.String("string"),
	Name:      pulumi.String("string"),
})
Copy
var postgresqlRoleResource = new PostgresqlRole("postgresqlRoleResource", PostgresqlRoleArgs.builder()
    .clusterId("string")
    .password("string")
    .name("string")
    .build());
Copy
postgresql_role_resource = azure.cosmosdb.PostgresqlRole("postgresqlRoleResource",
    cluster_id="string",
    password="string",
    name="string")
Copy
const postgresqlRoleResource = new azure.cosmosdb.PostgresqlRole("postgresqlRoleResource", {
    clusterId: "string",
    password: "string",
    name: "string",
});
Copy
type: azure:cosmosdb:PostgresqlRole
properties:
    clusterId: string
    name: string
    password: string
Copy

PostgresqlRole Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The PostgresqlRole resource accepts the following input properties:

ClusterId
This property is required.
Changes to this property will trigger replacement.
string
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
Password
This property is required.
Changes to this property will trigger replacement.
string
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
ClusterId
This property is required.
Changes to this property will trigger replacement.
string
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
Password
This property is required.
Changes to this property will trigger replacement.
string
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
clusterId
This property is required.
Changes to this property will trigger replacement.
String
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
password
This property is required.
Changes to this property will trigger replacement.
String
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
clusterId
This property is required.
Changes to this property will trigger replacement.
string
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
password
This property is required.
Changes to this property will trigger replacement.
string
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
cluster_id
This property is required.
Changes to this property will trigger replacement.
str
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
password
This property is required.
Changes to this property will trigger replacement.
str
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
clusterId
This property is required.
Changes to this property will trigger replacement.
String
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
password
This property is required.
Changes to this property will trigger replacement.
String
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the PostgresqlRole 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 PostgresqlRole Resource

Get an existing PostgresqlRole 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?: PostgresqlRoleState, opts?: CustomResourceOptions): PostgresqlRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cluster_id: Optional[str] = None,
        name: Optional[str] = None,
        password: Optional[str] = None) -> PostgresqlRole
func GetPostgresqlRole(ctx *Context, name string, id IDInput, state *PostgresqlRoleState, opts ...ResourceOption) (*PostgresqlRole, error)
public static PostgresqlRole Get(string name, Input<string> id, PostgresqlRoleState? state, CustomResourceOptions? opts = null)
public static PostgresqlRole get(String name, Output<String> id, PostgresqlRoleState state, CustomResourceOptions options)
resources:  _:    type: azure:cosmosdb:PostgresqlRole    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
ClusterId Changes to this property will trigger replacement. string
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
Password Changes to this property will trigger replacement. string
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
ClusterId Changes to this property will trigger replacement. string
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
Password Changes to this property will trigger replacement. string
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
clusterId Changes to this property will trigger replacement. String
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
password Changes to this property will trigger replacement. String
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
clusterId Changes to this property will trigger replacement. string
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
password Changes to this property will trigger replacement. string
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
cluster_id Changes to this property will trigger replacement. str
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
password Changes to this property will trigger replacement. str
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
clusterId Changes to this property will trigger replacement. String
The resource ID of the Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.
password Changes to this property will trigger replacement. String
The password of the Azure Cosmos DB for PostgreSQL Role. Changing this forces a new resource to be created.

Import

Azure Cosmos DB for PostgreSQL Roles can be imported using the resource id, e.g.

$ pulumi import azure:cosmosdb/postgresqlRole:PostgresqlRole example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/cluster1/roles/role1
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.