編輯

共用方式為


New-AzSqlInstanceStartStopSchedule

Creates start/stop schedule for Azure SQL Managed Instance

Syntax

New-AzSqlInstanceStartStopSchedule
   -InstanceName <String>
   -TimeZone <String>
   -ScheduleList <ScheduleItem[]>
   [-Description <String>]
   [-Force]
   [-ResourceGroupName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzSqlInstanceStartStopSchedule
   -TimeZone <String>
   -ScheduleList <ScheduleItem[]>
   [-Description <String>]
   -InstanceModel <AzureSqlManagedInstanceModel>
   [-Force]
   [-ResourceGroupName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates start/stop schedule for Azure SQL Managed Instance

Examples

Example 1

$newSchedule = New-AzSqlInstanceScheduleItem -StartDay Monday -StopDay Friday -StartTime "09:00" -StopTime "17:00"
New-AzSqlInstanceStartStopSchedule -InstanceName managed-instance-v2 -ResourceGroupName CustomerExperienceTeam_RG -ScheduleList $newSchedule -TimeZone "Central Europe Standard Time"

Creates new start/stop schedule that starts at Monday 9 AM and stops at Friday 5 PM.

Example 2

$mi = Get-AzSqlInstanceStartStopSchedule -InstanceName instance-name -ResourceGroupName rg-name

$existingSchedule = $mi.ScheduleList

$newSchedule = New-AzSqlInstanceScheduleItem -StartDay Monday -StopDay Friday -StartTime "09:00" -StopTime "17:00" -ScheduleList $existingSchedule

New-AzSqlInstanceStartStopSchedule -InstanceName managed-instance-v2 -ResourceGroupName CustomerExperienceTeam_RG -ScheduleList $newSchedule -TimeZone "Central Europe Standard Time"

Updates existing start/stop schedule with new schedule item starts at Monday 9 AM and stops at Friday 5 PM.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

The description of the schedule.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Skip confirmation message for performing the action

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InstanceModel

Instance model input object.

Type:AzureSqlManagedInstanceModel
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InstanceName

The name of the Azure SQL Managed Instance

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ScheduleList

Array of valid SheduleItem objects.

Type:ScheduleItem[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TimeZone

The name of the timezone for the schedule. Please refer to https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-timezone?view=powershell-7.3#examples for valid values.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

AzureSqlManagedInstanceModel

Outputs

AzureSqlManagedInstanceScheduleModel