Skip to main content

servers

Creates, updates, deletes, gets or lists a servers resource.

Overview

Nameservers
TypeResource
Idazure.postgresql_flexible_servers.servers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
administratorLoginstringName of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted.
administratorLoginPasswordstringPassword assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time.
authConfigobjectAuthentication configuration properties of a server.
availabilityZonestringAvailability zone of a server.
backupobjectBackup properties of a server.
clusterobjectCluster properties of a server.
createModestringCreation mode of a new server. Known values are: "Default", "Create", "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". (Default, Create, Update, PointInTimeRestore, GeoRestore, Replica, ReviveDropped)
dataEncryptionobjectData encryption properties of a server.
fullyQualifiedDomainNamestringFully qualified domain name of a server.
highAvailabilityobjectHigh availability properties of a server.
identityobjectUser assigned managed identities assigned to the server.
locationstringThe geo-location where the resource lives. Required.
maintenanceWindowobjectMaintenance window properties of a server.
minorVersionstringMinor version of PostgreSQL database engine.
networkobjectNetwork properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer.
pointInTimeUTCstring (date-time)Creation time (in ISO8601 format) of the backup which you want to restore in the new server. It's required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', or 'ReviveDropped'.
privateEndpointConnectionsarrayList of private endpoint connections associated with the specified server.
replicaobjectRead replica properties of a server. Required only in case that you want to promote a server.
replicaCapacityintegerMaximum number of read replicas allowed for a server.
replicationRolestringRole of the server in a replication set. Known values are: "None", "Primary", "AsyncReplica", and "GeoAsyncReplica". (None, Primary, AsyncReplica, GeoAsyncReplica)
skuobjectCompute tier and size of a server.
sourceServerResourceIdstringIdentifier of the server to be used as the source of the new server. Required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', 'Replica', or 'ReviveDropped'. This property is returned only when the target server is a read replica.
statestringPossible states of a server. Known values are: "Ready", "Dropping", "Disabled", "Starting", "Stopping", "Stopped", "Updating", "Restarting", "Inaccessible", and "Provisioning". (Ready, Dropping, Disabled, Starting, Stopping, Stopped, Updating, Restarting, Inaccessible, Provisioning)
storageobjectStorage properties of a server.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
versionstringMajor version of PostgreSQL database engine. Known values are: "18", "17", "16", "15", "14", "13", "12", and "11". (18, 17, 16, 15, 14, 13, 12, 11)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, server_name, subscription_idGets information about an existing server.
list_by_resource_groupselectresource_group_name, subscription_idLists all servers in a resource group.
list_by_subscriptionselectsubscription_idLists all servers in a subscription.
create_or_updateinsertresource_group_name, server_name, subscription_id, locationCreates a new server.
updateupdateresource_group_name, server_name, subscription_idUpdates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
create_or_updatereplaceresource_group_name, server_name, subscription_id, locationCreates a new server.
deletedeleteresource_group_name, server_name, subscription_idDeletes or drops an existing server.
restartexecresource_group_name, server_name, subscription_idRestarts PostgreSQL database engine in a server.
startexecresource_group_name, server_name, subscription_idStarts a stopped server.
stopexecresource_group_name, server_name, subscription_idStops a server.
migrate_network_modeexecresource_group_name, server_name, subscription_idMigrates an Azure Database for PostgreSQL server from VNet integration to a Private Link network model.
start_major_version_upgrade_precheckexecresource_group_name, server_name, subscription_id, targetVersionStart Major Version Upgrade Prechecks.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
server_namestringThe name of the server. Required.
subscription_idstring

SELECT examples

Gets information about an existing server.

SELECT
id,
name,
administratorLogin,
administratorLoginPassword,
authConfig,
availabilityZone,
backup,
cluster,
createMode,
dataEncryption,
fullyQualifiedDomainName,
highAvailability,
identity,
location,
maintenanceWindow,
minorVersion,
network,
pointInTimeUTC,
privateEndpointConnections,
replica,
replicaCapacity,
replicationRole,
sku,
sourceServerResourceId,
state,
storage,
systemData,
tags,
type,
version
FROM azure.postgresql_flexible_servers.servers
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND server_name = '{{ server_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates a new server.

INSERT INTO azure.postgresql_flexible_servers.servers (
tags,
location,
properties,
sku,
identity,
resource_group_name,
server_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ sku }}',
'{{ identity }}',
'{{ resource_group_name }}',
'{{ server_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
identity,
location,
properties,
sku,
systemData,
tags,
type
;

UPDATE examples

Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.

UPDATE azure.postgresql_flexible_servers.servers
SET
sku = '{{ sku }}',
identity = '{{ identity }}',
properties = '{{ properties }}',
tags = '{{ tags }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND server_name = '{{ server_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
identity,
location,
properties,
sku,
systemData,
tags,
type;

REPLACE examples

Creates a new server.

REPLACE azure.postgresql_flexible_servers.servers
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
sku = '{{ sku }}',
identity = '{{ identity }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND server_name = '{{ server_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
identity,
location,
properties,
sku,
systemData,
tags,
type;

DELETE examples

Deletes or drops an existing server.

DELETE FROM azure.postgresql_flexible_servers.servers
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND server_name = '{{ server_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Restarts PostgreSQL database engine in a server.

EXEC azure.postgresql_flexible_servers.servers.restart 
@resource_group_name='{{ resource_group_name }}' --required,
@server_name='{{ server_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"restartWithFailover": {{ restartWithFailover }},
"failoverMode": "{{ failoverMode }}"
}'
;