Maintenance Windows - Create Or Update

Sets maintenance windows settings for a database.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindows/current?maintenanceWindowName={maintenanceWindowName}&api-version=2021-11-01

URI Parameters

Name In Required Type Description
databaseName
path True

string

The name of the database to set maintenance windows for.

resourceGroupName
path True

string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

serverName
path True

string

The name of the server.

subscriptionId
path True

string

The subscription ID that identifies an Azure subscription.

api-version
query True

string

The API version to use for the request.

maintenanceWindowName
query True

string

Maintenance window name.

Request Body

Name Type Description
properties.timeRanges

MaintenanceWindowTimeRange[]

Maintenance window time range.

Responses

Name Type Description
200 OK

Successfully set maintenance windows settings.

Other Status Codes

*** Error Responses: ***

  • 400 InvalidMaintenanceWindowSelection - Invalid maintenance window selection.

Examples

Sets maintenance window settings for a selected database.

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdwdb/maintenanceWindows/current?maintenanceWindowName=current&api-version=2021-11-01

{
  "properties": {
    "timeRanges": [
      {
        "dayOfWeek": "Saturday",
        "startTime": "00:00:00",
        "duration": "PT60M"
      }
    ]
  }
}

Sample response

Definitions

Name Description
DayOfWeek

Day of maintenance window.

MaintenanceWindows

Maintenance windows.

MaintenanceWindowTimeRange

Maintenance window time range.

DayOfWeek

Day of maintenance window.

Name Type Description
Friday

string

Monday

string

Saturday

string

Sunday

string

Thursday

string

Tuesday

string

Wednesday

string

MaintenanceWindows

Maintenance windows.

Name Type Description
id

string

Resource ID.

name

string

Resource name.

properties.timeRanges

MaintenanceWindowTimeRange[]

Maintenance window time range.

type

string

Resource type.

MaintenanceWindowTimeRange

Maintenance window time range.

Name Type Description
dayOfWeek

DayOfWeek

Day of maintenance window.

duration

string

Duration of maintenance window in minutes.

startTime

string

Start time minutes offset from 12am.