1. Packages
  2. Azure Classic
  3. API Docs
  4. postgresql
  5. getServer

We recommend using Azure Native.

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

azure.postgresql.getServer

Explore with Pulumi AI

We recommend using Azure Native.

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

Use this data source to access information about an existing PostgreSQL Azure Database Server.

Example Usage

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

const example = azure.postgresql.getServer({
    name: "postgresql-server-1",
    resourceGroupName: "api-rg-pro",
});
export const postgresqlServerId = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.postgresql.get_server(name="postgresql-server-1",
    resource_group_name="api-rg-pro")
pulumi.export("postgresqlServerId", example.id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := postgresql.LookupServer(ctx, &postgresql.LookupServerArgs{
			Name:              "postgresql-server-1",
			ResourceGroupName: "api-rg-pro",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("postgresqlServerId", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.PostgreSql.GetServer.Invoke(new()
    {
        Name = "postgresql-server-1",
        ResourceGroupName = "api-rg-pro",
    });

    return new Dictionary<string, object?>
    {
        ["postgresqlServerId"] = example.Apply(getServerResult => getServerResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.postgresql.PostgresqlFunctions;
import com.pulumi.azure.postgresql.inputs.GetServerArgs;
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 example = PostgresqlFunctions.getServer(GetServerArgs.builder()
            .name("postgresql-server-1")
            .resourceGroupName("api-rg-pro")
            .build());

        ctx.export("postgresqlServerId", example.applyValue(getServerResult -> getServerResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:postgresql:getServer
      arguments:
        name: postgresql-server-1
        resourceGroupName: api-rg-pro
outputs:
  postgresqlServerId: ${example.id}
Copy

Using getServer

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getServer(args: GetServerArgs, opts?: InvokeOptions): Promise<GetServerResult>
function getServerOutput(args: GetServerOutputArgs, opts?: InvokeOptions): Output<GetServerResult>
Copy
def get_server(name: Optional[str] = None,
               resource_group_name: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetServerResult
def get_server_output(name: Optional[pulumi.Input[str]] = None,
               resource_group_name: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetServerResult]
Copy
func LookupServer(ctx *Context, args *LookupServerArgs, opts ...InvokeOption) (*LookupServerResult, error)
func LookupServerOutput(ctx *Context, args *LookupServerOutputArgs, opts ...InvokeOption) LookupServerResultOutput
Copy

> Note: This function is named LookupServer in the Go SDK.

public static class GetServer 
{
    public static Task<GetServerResult> InvokeAsync(GetServerArgs args, InvokeOptions? opts = null)
    public static Output<GetServerResult> Invoke(GetServerInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
public static Output<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:postgresql/getServer:getServer
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the PostgreSQL Server.
ResourceGroupName This property is required. string
Specifies the name of the Resource Group where the PostgreSQL Server exists.
Name This property is required. string
The name of the PostgreSQL Server.
ResourceGroupName This property is required. string
Specifies the name of the Resource Group where the PostgreSQL Server exists.
name This property is required. String
The name of the PostgreSQL Server.
resourceGroupName This property is required. String
Specifies the name of the Resource Group where the PostgreSQL Server exists.
name This property is required. string
The name of the PostgreSQL Server.
resourceGroupName This property is required. string
Specifies the name of the Resource Group where the PostgreSQL Server exists.
name This property is required. str
The name of the PostgreSQL Server.
resource_group_name This property is required. str
Specifies the name of the Resource Group where the PostgreSQL Server exists.
name This property is required. String
The name of the PostgreSQL Server.
resourceGroupName This property is required. String
Specifies the name of the Resource Group where the PostgreSQL Server exists.

getServer Result

The following output properties are available:

AdministratorLogin string
The administrator username of the PostgreSQL Server.
Fqdn string
The fully qualified domain name of the PostgreSQL Server.
Id string
The provider-assigned unique ID for this managed resource.
Identities List<GetServerIdentity>
An identity block as defined below.
Location string
The location of the Resource Group in which the PostgreSQL Server exists.
Name string
ResourceGroupName string
SkuName string
The SKU name of the PostgreSQL Server.
Tags Dictionary<string, string>
A mapping of tags assigned to the resource.
Version string
The version of the PostgreSQL Server.
AdministratorLogin string
The administrator username of the PostgreSQL Server.
Fqdn string
The fully qualified domain name of the PostgreSQL Server.
Id string
The provider-assigned unique ID for this managed resource.
Identities []GetServerIdentity
An identity block as defined below.
Location string
The location of the Resource Group in which the PostgreSQL Server exists.
Name string
ResourceGroupName string
SkuName string
The SKU name of the PostgreSQL Server.
Tags map[string]string
A mapping of tags assigned to the resource.
Version string
The version of the PostgreSQL Server.
administratorLogin String
The administrator username of the PostgreSQL Server.
fqdn String
The fully qualified domain name of the PostgreSQL Server.
id String
The provider-assigned unique ID for this managed resource.
identities List<GetServerIdentity>
An identity block as defined below.
location String
The location of the Resource Group in which the PostgreSQL Server exists.
name String
resourceGroupName String
skuName String
The SKU name of the PostgreSQL Server.
tags Map<String,String>
A mapping of tags assigned to the resource.
version String
The version of the PostgreSQL Server.
administratorLogin string
The administrator username of the PostgreSQL Server.
fqdn string
The fully qualified domain name of the PostgreSQL Server.
id string
The provider-assigned unique ID for this managed resource.
identities GetServerIdentity[]
An identity block as defined below.
location string
The location of the Resource Group in which the PostgreSQL Server exists.
name string
resourceGroupName string
skuName string
The SKU name of the PostgreSQL Server.
tags {[key: string]: string}
A mapping of tags assigned to the resource.
version string
The version of the PostgreSQL Server.
administrator_login str
The administrator username of the PostgreSQL Server.
fqdn str
The fully qualified domain name of the PostgreSQL Server.
id str
The provider-assigned unique ID for this managed resource.
identities Sequence[GetServerIdentity]
An identity block as defined below.
location str
The location of the Resource Group in which the PostgreSQL Server exists.
name str
resource_group_name str
sku_name str
The SKU name of the PostgreSQL Server.
tags Mapping[str, str]
A mapping of tags assigned to the resource.
version str
The version of the PostgreSQL Server.
administratorLogin String
The administrator username of the PostgreSQL Server.
fqdn String
The fully qualified domain name of the PostgreSQL Server.
id String
The provider-assigned unique ID for this managed resource.
identities List<Property Map>
An identity block as defined below.
location String
The location of the Resource Group in which the PostgreSQL Server exists.
name String
resourceGroupName String
skuName String
The SKU name of the PostgreSQL Server.
tags Map<String>
A mapping of tags assigned to the resource.
version String
The version of the PostgreSQL Server.

Supporting Types

GetServerIdentity

PrincipalId This property is required. string
The ID of the System Managed Service Principal assigned to the PostgreSQL Server.
TenantId This property is required. string
The ID of the Tenant of the System Managed Service Principal assigned to the PostgreSQL Server.
Type This property is required. string
The identity type of the Managed Identity assigned to the PostgreSQL Server.
PrincipalId This property is required. string
The ID of the System Managed Service Principal assigned to the PostgreSQL Server.
TenantId This property is required. string
The ID of the Tenant of the System Managed Service Principal assigned to the PostgreSQL Server.
Type This property is required. string
The identity type of the Managed Identity assigned to the PostgreSQL Server.
principalId This property is required. String
The ID of the System Managed Service Principal assigned to the PostgreSQL Server.
tenantId This property is required. String
The ID of the Tenant of the System Managed Service Principal assigned to the PostgreSQL Server.
type This property is required. String
The identity type of the Managed Identity assigned to the PostgreSQL Server.
principalId This property is required. string
The ID of the System Managed Service Principal assigned to the PostgreSQL Server.
tenantId This property is required. string
The ID of the Tenant of the System Managed Service Principal assigned to the PostgreSQL Server.
type This property is required. string
The identity type of the Managed Identity assigned to the PostgreSQL Server.
principal_id This property is required. str
The ID of the System Managed Service Principal assigned to the PostgreSQL Server.
tenant_id This property is required. str
The ID of the Tenant of the System Managed Service Principal assigned to the PostgreSQL Server.
type This property is required. str
The identity type of the Managed Identity assigned to the PostgreSQL Server.
principalId This property is required. String
The ID of the System Managed Service Principal assigned to the PostgreSQL Server.
tenantId This property is required. String
The ID of the Tenant of the System Managed Service Principal assigned to the PostgreSQL Server.
type This property is required. String
The identity type of the Managed Identity assigned to the PostgreSQL Server.

Package Details

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

We recommend using Azure Native.

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