2. You run another two 8vCores instances from 2pm to 8pm
Update: Aug 2023
Define parameters
$SubscriptionId = "<SubscriptionID>"
$SqlMIName = "<Sql-MI-name>"
$RgName = "<ResourceGroup>"
# Login-AzAccount
Select-AzSubscription -SubscriptionName $SubscriptionID
Stop-AzSqlInstance -Name $SqlMIName -ResourceGroupName $RgName
Manual start
Start-AzSqlInstance -Name $SqlMIName -ResourceGroupName $RgName
Create or update schedule
$newSchedule = [System.Collections.ArrayList]::new()
$newScheduleMonday = New-AzSqlInstanceScheduleItem -StartDay Monday -StopDay Monday -StartTime "09:00" -StopTime "17:00"
$newSchedule.add($newScheduleMonday)
$newScheduleTuesday = New-AzSqlInstanceScheduleItem -StartDay Tuesday -StopDay Tuesday -StartTime "09:00" -StopTime "17:00"
$newSchedule.add($newScheduleTuesday)
$newScheduleWednesday = New-AzSqlInstanceScheduleItem -StartDay Wednesday -StopDay Wednesday -StartTime "07:00" -StopTime "19:00"
$newSchedule.add($newScheduleWednesday)
$newScheduleThursday = New-AzSqlInstanceScheduleItem -StartDay Thursday -StopDay Thursday -StartTime "09:00" -StopTime "17:00"
$newSchedule.add($newScheduleThursday)
$newScheduleFriday = New-AzSqlInstanceScheduleItem -StartDay Friday -StopDay Friday -StartTime "11:00" -StopTime "17:00"
$newSchedule.add($newScheduleFriday)
New-AzSqlInstanceStartStopSchedule -InstanceName $SqlMIName -ResourceGroupName $RgName -TimeZone "Central Europe Standard Time" -ScheduleList $newSchedule
Get schedule
$currentSchedule = Get-AzSqlInstanceStartStopSchedule -InstanceName $SqlMIName -ResourceGroupName $RgName
$scheduleItemsList = $currentSchedule.ScheduleList
$scheduleItemsList
Delete schedule
Remove-AzSqlInstanceStartStopSchedule -InstanceName $SqlMIName -ResourceGroupName $RgName
Define parameters
subscription="<subscriptionId>"
instanceName="<managedInstanceName>"
resourceGroupName="<managedInstanceResourceGroup>"
az account set -s $subscription # ...or use 'az login'
Manual stop
az sql mi stop --mi $instanceName -g $resourceGroupName
Manual start
az sql mi start --mi $instanceName -g $resourceGroupName
Create or update schedule
scheduleItems="[{'startDay':'Monday','startTime':'10:00','stopDay':'Monday','stopTime':'18:00'},{'startDay':'Tuesday','startTime':'10:00','stopDay':'Tuesday','stopTime':'18:00'},{'startDay':'Wednesday','startTime':'12:00','stopDay':'Wednesday','stopTime':'22:00'},{'startDay':'Thursday','startTime':'14:00','stopDay':'Thursday','stopTime':'20:00'},{'startDay':'Friday','startTime':'14:00','stopDay':'Friday','stopTime':'20:00'}]"
timezone="Central Europe Standard Time"
az sql mi start-stop-schedule create --mi "$instanceName" -g "$resourceGroupName" --timezone-id "$timezone" --schedule-list "$scheduleItems"
Get schedule
az sql mi start-stop-schedule show --mi "$instanceName" -g "$resourceGroupName"
Delete schedule
az sql mi start-stop-schedule delete --mi "$instanceName" -g "$resourceGroupName"
Powershell
New-AzSqlInstanceStartStopSchedule
Get-AzSqlInstanceStartStopSchedule
Remove-AzSqlInstanceStartStopSchedule
Azure CLI
aq sql mi start-stop-schedule create
aq sql mi start-stop-schedule show
aq sql mi start-stop-schedule update
aq sql mi start-stop-schedule delete
API
Start Stop Managed Instance Schedules - Create Or Update
Start Stop Managed Instance Schedules - Get
Start Stop Managed Instance Schedules - Delete
Summary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.