Partilhar via


Start Stop Managed Instance Schedules - Create Or Update

Creates or updates the managed instance's Start/Stop schedule.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/default?api-version=2024-05-01-preview

URI Parameters

Name In Required Type Description
managedInstanceName
path True

string

The name of the managed instance.

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.

startStopScheduleName
path True

StartStopScheduleName

Name of the managed instance Start/Stop schedule.

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.

Request Body

Name Required Type Description
properties.scheduleList True

ScheduleItem[]

Schedule list.

properties.description

string

The description of the schedule.

properties.timeZoneId

string

The time zone of the schedule.

Responses

Name Type Description
200 OK

StartStopManagedInstanceSchedule

Successfully set the Start/Stop schedule.

201 Created

StartStopManagedInstanceSchedule

Successfully created the Start/Stop schedule.

Other Status Codes

ErrorResponse

*** Error Responses: ***

  • 204 ManagementServiceStartStopManagedInstanceScheduleNameInvalid - User attempted to perform CRUD operation of Start/Stop schedule with a schedule name different from 'default'

  • 400 ManagementServiceStartStopManagedInstanceScheduleCreateOrUpdateRequestParametersInvalid - The provided set of parameters in the body of the request is either empty or invalid.

  • 400 ManagementServiceStartStopManagedInstanceScheduleCreateOrUpdateRequestTimeZoneInvalid - The provided time zone parameter is invalid.

  • 400 ManagementServiceStartStopManagedInstanceScheduleCreateOrUpdateRequestScheduleInvalid - The provided Start/Stop schedule is invalid. The schedule either contains no items in the schedule list or some of the items in the list have invalid values.

  • 400 StartStopOfManagedInstanceIsDisabled - Start and stop operation on managed instance is not enabled.

  • 400 ManagementServiceStartStopManagedInstanceScheduleSubscriptionNotEnabledForFeature - User attempted to use Start/Stop feature without having the subscription allowlisted for the appropriate subscription feature.

  • 400 ManagementServiceStartStopManagedInstanceScheduleFeatureDisabled - User attempted to use the scheduled Start/Stop Azure SQL Managed Instance feature, which is disabled.

  • 400 ManagementServiceStartStopManagedInstanceScheduleNotSupportedOnSKU - Scheduled Start/Stop operation is not supported on the given SKU.

  • 400 ManagementServiceStopManagedInstanceHostedOnRdfePlatform - Stop executed on the instance that is not running with Feature Wave November 2022

  • 400 ManagementServiceStartStopManagedInstanceScheduleOverlap - Overlap in schedule pairs.

  • 400 ManagementServiceStartStopManagedInstanceScheduleSmallTimespan - Time between two successive actions is less than 1 hour.

  • 404 ManagementServiceStartStopManagedInstanceScheduleNameInvalid - User attempted to perform CRUD operation of Start/Stop schedule with a schedule name different from 'default'

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 404 ResourceNotFound - The requested resource was not found.

  • 404 ManagementServiceStartStopManagedInstanceScheduleNotFound - Schedule does not exist for a given managed instance.

  • 409 ManagementServiceStartStopManagedInstanceScheduleConflictingOperation - The attempted create/update/delete operation of Start/Stop schedule on the Azure SQL Managed Instance failed. The schedule was either not created or couldn't be updated/deleted as it was busy with an ongoing scheduled operation. Please retry your request later.

Examples

Creates or updates the managed instance's Start/Stop schedule with all optional parameters specified.
Creates or updates the managed instance's Start/Stop schedule with no optional parameters specified.

Creates or updates the managed instance's Start/Stop schedule with all optional parameters specified.

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/schedulerg/providers/Microsoft.Sql/managedInstances/schedulemi/startStopSchedules/default?api-version=2024-05-01-preview

{
  "properties": {
    "timeZoneId": "Central European Standard Time",
    "description": "This is a schedule for our Dev/Test environment.",
    "scheduleList": [
      {
        "startDay": "Thursday",
        "startTime": "18:00",
        "stopDay": "Thursday",
        "stopTime": "17:00"
      },
      {
        "startDay": "Thursday",
        "startTime": "15:00",
        "stopDay": "Thursday",
        "stopTime": "14:00"
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/schedulerg/providers/Microsoft.Sql/managedInstances/schedulemi/startStopSchedules/default",
  "name": "default",
  "systemData": {
    "createdBy": "string",
    "createdByType": "User",
    "createdAt": "2021-08-26T04:41:33.937Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2021-08-27T04:41:33.937Z"
  },
  "properties": {
    "description": "This is a schedule for our Dev/Test environment.",
    "nextExecutionTime": "2021-08-26T14:00:00",
    "nextRunAction": "Stop",
    "scheduleList": [
      {
        "startDay": "Thursday",
        "startTime": "06:00 PM",
        "stopDay": "Thursday",
        "stopTime": "05:00 PM"
      },
      {
        "startDay": "Thursday",
        "startTime": "03:00 PM",
        "stopDay": "Thursday",
        "stopTime": "02:00 PM"
      }
    ],
    "timeZoneId": "Central European Standard Time"
  },
  "type": "Microsoft.Sql/managedInstances/startStopSchedules"
}
{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/schedulerg/providers/Microsoft.Sql/managedInstances/schedulemi/startStopSchedules/default",
  "name": "default",
  "systemData": {
    "createdBy": "string",
    "createdByType": "User",
    "createdAt": "2021-08-26T04:41:33.937Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2021-08-26T04:41:33.937Z"
  },
  "properties": {
    "description": "This is a schedule for our Dev/Test environment.",
    "nextExecutionTime": "2021-08-26T14:00:00",
    "nextRunAction": "Stop",
    "scheduleList": [
      {
        "startDay": "Thursday",
        "startTime": "06:00 PM",
        "stopDay": "Thursday",
        "stopTime": "05:00 PM"
      },
      {
        "startDay": "Thursday",
        "startTime": "03:00 PM",
        "stopDay": "Thursday",
        "stopTime": "02:00 PM"
      }
    ],
    "timeZoneId": "Central European Standard Time"
  },
  "type": "Microsoft.Sql/managedInstances/startStopSchedules"
}

Creates or updates the managed instance's Start/Stop schedule with no optional parameters specified.

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/schedulerg/providers/Microsoft.Sql/managedInstances/schedulemi/startStopSchedules/default?api-version=2024-05-01-preview

{
  "properties": {
    "scheduleList": [
      {
        "startDay": "Thursday",
        "startTime": "18:00",
        "stopDay": "Thursday",
        "stopTime": "17:00"
      },
      {
        "startDay": "Thursday",
        "startTime": "15:00",
        "stopDay": "Thursday",
        "stopTime": "14:00"
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/schedulerg/providers/Microsoft.Sql/managedInstances/schedulemi/startStopSchedules/default",
  "name": "default",
  "systemData": {
    "createdBy": "string",
    "createdByType": "User",
    "createdAt": "2021-08-26T04:41:33.937Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2021-08-27T04:41:33.937Z"
  },
  "properties": {
    "description": "",
    "nextExecutionTime": "2021-08-26T14:00:00",
    "nextRunAction": "Stop",
    "scheduleList": [
      {
        "startDay": "Thursday",
        "startTime": "06:00 PM",
        "stopDay": "Thursday",
        "stopTime": "05:00 PM"
      },
      {
        "startDay": "Thursday",
        "startTime": "03:00 PM",
        "stopDay": "Thursday",
        "stopTime": "02:00 PM"
      }
    ],
    "timeZoneId": "UTC"
  },
  "type": "Microsoft.Sql/managedInstances/startStopSchedules"
}
{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/schedulerg/providers/Microsoft.Sql/managedInstances/schedulemi/startStopSchedules/default",
  "name": "default",
  "systemData": {
    "createdBy": "string",
    "createdByType": "User",
    "createdAt": "2021-08-26T04:41:33.937Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2021-08-26T04:41:33.937Z"
  },
  "properties": {
    "description": "",
    "nextExecutionTime": "2021-08-26T14:00:00",
    "nextRunAction": "Stop",
    "scheduleList": [
      {
        "startDay": "Thursday",
        "startTime": "06:00 PM",
        "stopDay": "Thursday",
        "stopTime": "05:00 PM"
      },
      {
        "startDay": "Thursday",
        "startTime": "03:00 PM",
        "stopDay": "Thursday",
        "stopTime": "02:00 PM"
      }
    ],
    "timeZoneId": "UTC"
  },
  "type": "Microsoft.Sql/managedInstances/startStopSchedules"
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

DayOfWeek

Start day.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

ScheduleItem

Schedule info describing when the server should be started or stopped.

StartStopManagedInstanceSchedule

Managed instance's Start/Stop schedule.

StartStopScheduleName

Name of the managed instance Start/Stop schedule.

systemData

Metadata pertaining to creation and last modification of the resource.

createdByType

The type of identity that created the resource.

Name Type Description
Application

string

Key

string

ManagedIdentity

string

User

string

DayOfWeek

Start day.

Name Type Description
Friday

string

Monday

string

Saturday

string

Sunday

string

Thursday

string

Tuesday

string

Wednesday

string

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.

ScheduleItem

Schedule info describing when the server should be started or stopped.

Name Type Description
startDay

DayOfWeek

Start day.

startTime

string

Start time.

stopDay

DayOfWeek

Stop day.

stopTime

string

Stop time.

StartStopManagedInstanceSchedule

Managed instance's Start/Stop schedule.

Name Type Default value Description
id

string

Resource ID.

name

string

Resource name.

properties.description

string

The description of the schedule.

properties.nextExecutionTime

string

Timestamp when the next action will be executed in the corresponding schedule time zone.

properties.nextRunAction

string

Next action to be executed (Start or Stop)

properties.scheduleList

ScheduleItem[]

Schedule list.

properties.timeZoneId

string

UTC

The time zone of the schedule.

systemData

systemData

System data of the scheduled resource.

type

string

Resource type.

StartStopScheduleName

Name of the managed instance Start/Stop schedule.

Name Type Description
default

string

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string

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

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.