Modifier

Partager via


New-AzAutomationUpdateManagementAzureQuery

Creates an Update Management Azure Query object.

Syntax

New-AzAutomationUpdateManagementAzureQuery
   -Scope <String[]>
   [-Location <String[]>]
   [-Tag <Hashtable>]
   [-FilterOperator <TagOperators>]
   [-ResourceGroupName] <String>
   [-AutomationAccountName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Creates an "Update Management Azure Query" object that will dynamically resolve a list of Azure virtual machines for use in scheduling software updates.

Examples

Example 1

$query1Scope = @(
    "/subscriptions/22e2445a-0984-4fa5-86a4-0280d76c4b2c/resourceGroups/resourceGroupName",
    "/subscriptions/32e2445a-0984-4fa5-86a4-0280d76c4b2d/"
)
$query1Location =@("Japan East", "UK South")
$query1FilterOperator = "All"
$tag1 = @{"tag1"= @("tag1Value1", "tag1Value2")}
$tag1.add("tag2", "tag2Value")
$azq = New-AzAutomationUpdateManagementAzureQuery -ResourceGroupName "mygroup" `
                                       -AutomationAccountName "myaccount" `
                                       -Scope $query1Scope `
                                       -Location $query1Location `
                                       -Tag $tag1
$AzureQueries = @($azq)
$startTime = [DateTimeOffset]"2018-09-13T21:00"

$duration = New-TimeSpan -Hours 2
$schedule = New-AzAutomationSchedule -ResourceGroupName "mygroup" `
                                                  -AutomationAccountName "myaccount" `
                                                  -Name MyWeeklySchedule `
                                                  -StartTime $startTime `
                                                  -DaysOfWeek Saturday `
                                                  -WeekInterval 1 `
                                                  -ForUpdateConfiguration

New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName "mygroup" `
                                                 -AutomationAccountName "myaccount" `
                                                 -Schedule $schedule `
                                                 -Windows `
                                                 -AzureQuery $AzureQueries `
                                                 -IncludedUpdateClassification Critical `
                                                 -Duration $duration

UpdateConfiguration   : Microsoft.Azure.Commands.Automation.Model.UpdateManagement.UpdateConfiguration
ScheduleConfiguration : Microsoft.Azure.Commands.Automation.Model.Schedule
ProvisioningState     : Provisioning
ErrorInfo             :
ResourceGroupName     : mygroup
AutomationAccountName : myaccount
Name                  : MyWeeklySchedule
CreationTime          : 9/14/2018 3:53:27 AM +00:00
LastModifiedTime      : 9/14/2018 3:53:27 AM +00:00
Description           :

Parameters

-AutomationAccountName

The automation account name.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
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

-FilterOperator

Tag filter operator.

Type:TagOperators
Accepted values:All, Any
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Location

List of locations for azure virtual machines.

Type:String[]
Aliases:Locaton
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The resource group name.

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

-Scope

Resource Ids for azure virtual machines.

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

-Tag

Tag for azure virtual machines.

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

Inputs

String[]

Hashtable

TagOperators

String

Outputs

AzureQueryProperties