DB Agent - Create Or Update

Enables or disables the database agent for a flexible server.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/dbAgents/Default?api-version=2026-07-01-preview

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

serverName
path True

string

minLength: 3
maxLength: 63
pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*

The name of the server.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
properties True

DbAgentForUpdateProperties

The requested database agent properties.

Responses

Name Type Description
202 Accepted

DbAgent

The response returned when a database agent write is accepted.

Headers

  • Azure-AsyncOperation: string
  • Location: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Disable the singleton Default database agent for a server.
Enable the singleton Default database agent for a server.

Disable the singleton Default database agent for a server.

Sample request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/dbAgents/Default?api-version=2026-07-01-preview

{
  "properties": {
    "state": "Disabled"
  }
}

Sample response

Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2026-07-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2026-07-01-preview
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/dbAgents/Default",
  "name": "Default",
  "type": "Microsoft.DBforPostgreSQL/flexibleServers/dbAgents",
  "properties": {
    "state": "Disabling",
    "provisioningState": "InProgress",
    "lastModifiedTime": "2026-08-28T15:30:00Z"
  }
}

Enable the singleton Default database agent for a server.

Sample request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/dbAgents/Default?api-version=2026-07-01-preview

{
  "properties": {
    "state": "Enabled"
  }
}

Sample response

Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2026-07-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2026-07-01-preview
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/dbAgents/Default",
  "name": "Default",
  "type": "Microsoft.DBforPostgreSQL/flexibleServers/dbAgents",
  "properties": {
    "state": "Enabling",
    "provisioningState": "InProgress",
    "lastModifiedTime": "2026-08-28T15:30:00Z"
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

DbAgent

The database agent configuration for a PostgreSQL flexible server.

DbAgentForUpdate

A request to enable or disable the database agent.

DbAgentForUpdateProperties

Writable properties of the database agent configuration.

DbAgentForUpdateState

The database agent states accepted in a write request.

DbAgentProperties

Properties of the database agent configuration.

DbAgentProvisioningState

The provisioning state of the database agent resource.

DbAgentState

The state of the database agent.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

systemData

Metadata pertaining to creation and last modification of the resource.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

DbAgent

The database agent configuration for a PostgreSQL flexible server.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties

DbAgentProperties

The resource-specific properties for this resource.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

DbAgentForUpdate

A request to enable or disable the database agent.

Name Type Description
properties

DbAgentForUpdateProperties

The requested database agent properties.

DbAgentForUpdateProperties

Writable properties of the database agent configuration.

Name Type Description
state

DbAgentForUpdateState

The requested state of the database agent.

DbAgentForUpdateState

The database agent states accepted in a write request.

Value Description
Enabled

Enable the database agent.

Disabled

Disable the database agent.

DbAgentProperties

Properties of the database agent configuration.

Name Type Description
lastModifiedTime

string (date-time)

The time when the database agent configuration was last modified.

provisioningState

DbAgentProvisioningState

The provisioning state of the database agent resource.

state

DbAgentState

The state of the database agent.

DbAgentProvisioningState

The provisioning state of the database agent resource.

Value Description
Succeeded

Resource has been created.

Failed

Resource creation failed.

Canceled

Resource creation was canceled.

InProgress

The database agent lifecycle operation is in progress.

DbAgentState

The state of the database agent.

Value Description
Enabling

The database agent is being enabled.

Enabled

The database agent is enabled.

Disabling

The database agent is being disabled.

Disabled

The database agent is disabled.

Failed

The database agent lifecycle operation failed.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.