azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

TimeZone ignored when deploying New-AzAutomationSoftwareUpdateConfiguration

Open joezuchora opened this issue 7 years ago • 12 comments

Description

TimeZone is ignored in New-AzAutomationSoftwareUpdateConfiguration.

I first create a schedule in EST - $sch1

StartTime              : 9/5/2019 6:00:00 PM -04:00
ExpiryTime             : 12/31/9999 11:59:59 PM +00:00
IsEnabled              : False
NextRun                :
Interval               :
Frequency              : Onetime
MonthlyScheduleOptions :
WeeklyScheduleOptions  :
TimeZone               : America/New_York
ResourceGroupName      :
AutomationAccountName  :
Name                   : 2019-09 Maintenance Step1-Update Management Machine
CreationTime           : 1/1/0001 12:00:00 AM +00:00
LastModifiedTime       : 1/1/0001 12:00:00 AM +00:00
Description            :

I then use that as in input into New-AzAutomationSoftwareUpdateConfiguration and magically 4 hours are added to the schedule and it's updated. You can see the results in the response body that the startTime has magically changed to 10PM when it should be 6PM as it is in the schedule.

Steps to reproduce

# Maintenance-Step1-Update Management Machine (Patches - Computer Id List 3)
$sch1 = New-AzAutomationSchedule -ResourceGroupName $rgName -AutomationAccountName $aaName -Name $schName1 -StartTime $schTime1 -OneTime -ForUpdateConfiguration -Timezone $timezone -ErrorVariable Err -Debug
# Create Software Update Config object
$suc1 = New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $rgName -AutomationAccountName $aaName -Schedule $sch1 -Windows -AzureVMResourceId $cidl3 -IncludedUpdateClassification $updates -Duration $duration -ErrorVariable +Err -Debug


Environment data

Name                           Value
----                           -----
PSVersion                      5.1.17763.592
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.592
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.6.1      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}
Script     1.5.3      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}
Script     1.0.1      Az.Aks                              {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script     1.1.0      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-AzAnalysisServicesServer...}
Script     1.1.0      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, Add-AzApiManagementUserToGroup...}
Script     1.0.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzApplicationInsightsPricingPlan...}
Script     1.2.2      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomationDscNodeConfiguration...}
Script     1.1.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey, New-AzBatchAccount...}
Script     1.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget...}
Script     1.3.0      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script     1.1.1      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesAccountSku, Get-AzCognitiveServicesAccountType...}
Script     2.3.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet...}
Script     1.0.1      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}
Script     1.0.1      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry...}
Script     1.1.1      Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2...}
Script     1.0.0      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCatalogCredential, Set-AzDataLakeAnalyticsCatalogCredential...}
Script     1.2.1      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreFirewallRule, Set-AzDataLakeStoreTrustedIdProvider...}
Script     1.0.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentManagerArtifactSource, Set-AzDeploymentManagerArtifactSource, Remove-AzDeploymentManagerArtifactSource...}
Script     1.0.0      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPolicy...}
Script     1.1.1      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script     1.2.0      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...}
Script     1.2.0      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHubNamespace...}
Script     1.1.0      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove-AzFrontDoor...}
Script     2.0.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStreamingMapReduceJobDefinition...}
Script     1.1.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIotHubJob...}
Script     1.2.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVaultCertificateOperation...}
Script     1.2.1      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccountBatchConfiguration, Get-AzIntegrationAccountCallbackUrl...}
Script     1.1.0      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageHistory, Remove-AzMlCommitmentPlan...}
Script     1.0.0      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.1.0      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMediaServiceKey, Get-AzMediaServiceNameAvailability...}
Script     1.2.1      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script     1.10.0     Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertificate, New-AzApplicationGatewayAuthenticationCertificate, Remove-AzApplicationGatewayAuthenticationCe...
Script     1.1.0      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get-AzNotificationHubPNSCredential...}
Script     1.3.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSource, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsightsIISLogCollect...
Script     1.1.1      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation...}
Script     1.1.0      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollectionAccessKey, Get-AzPowerBIWorkspace...}
Script     1.4.1      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVaultSettingsFile, New-AzRecoveryServicesVault...}
Script     1.1.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, New-AzRedisCachePatchSchedule...}
Script     1.0.1      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...}
Script     0.7.4      Az.ResourceGraph                    Search-AzGraph
Script     1.5.0      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment...}
Script     1.2.0      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServiceBusNamespace...}
Script     1.1.1      Az.ServiceFabric                    {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServiceFabricClusterCertificate, Add-AzServiceFabricNode...}
Script     1.0.2      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script     1.12.0     Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, Set-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseUpgradeHint...}
Script     1.4.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey...}
Script     1.0.0      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnalyticsFunction, Remove-AzStreamAnalyticsFunction...}
Script     1.0.1      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Remove-AzTrafficManagerCustomHeaderFromProfile...}
Script     1.3.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...}
Binary     2.0.2.24   AzureADPreview                      {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-AzureADApplicationExtensionProperty, Get-AzureADApplicationOwner...}
Binary     16.0.91... Microsoft.Online.SharePoint.Powe... {Register-SPODataEncryptionPolicy, Update-SPODataEncryptionPolicy, Get-SPODataEncryptionPolicy, Get-SPOSiteDataEncryptionPolicy...}
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     3.4.0      Pester                              {Describe, Context, It, Should...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption...}
Script     1.0.29     PSSoftware                          {Compare-FilePath, Compare-FolderPath, Convert-CompressedGuidToGuid, Convert-GuidToCompressedGuid...}
Script     21.1.18135 SqlServer                           {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp, Add-SqlAzureAuthenticationContext...}

Debug output

PS C:\Users\jzuchora\source\repos> # Create Software Update Config object
        $suc1 = New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $rgName -AutomationAccountName $aaName -Schedule $sch1 -Windows -AzureVMResourceId $cidl3 -IncludedUpdateClassification $updates -Duration $duration -ErrorVariable +Err -Debug
DEBUG: 5:09:17 PM - NewAzureAutomationSoftwareUpdateConfiguration begin processing with ParameterSet 'Windows'.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: 5:09:21 PM - using account id '[email protected]'...
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Creating Azure Automation Software Update Configuration." on target "2019-09 Maintenance Step1-Update Management Machine".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Yes"):
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: 'c1e0b6a1-e090-4c0a-b206-30f26baf583d'
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'c1e0b6a1-e090-4c0a-b206-30f26baf583d', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthority: 'True'
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/c1e0b6a1-e090-4c0a-b206-30f26baf583d/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: 'c1e0b6a1-e090-4c0a-b206-30f26baf583d', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3502038Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3502038Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"):
DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3502038Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: === Token Acquisition started: 
        CacheType: null
        Authentication Target: User
        , Authority Host: login.microsoftonline.com

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"): a
DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3502038Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: === Token Acquisition started:
        Authority: https://login.microsoftonline.com/c1e0b6a1-e090-4c0a-b206-30f26baf583d/
        Resource: https://management.core.windows.net/
        ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
        CacheType: null
        Authentication Target: User


DEBUG: [ADAL]: Verbose: 2019-09-05T21:09:22.3502038Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: Loading from cache.

DEBUG: [ADAL]: Verbose: 2019-09-05T21:09:22.3502038Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: Loading from cache.

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 92 items to token cache.

DEBUG: [ADAL]: Verbose: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: Looking up cache for a token...

DEBUG: [ADAL]: Verbose: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: Looking up cache for a token...

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: An item matching the requested resource was found in the cache

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: An item matching the requested resource was found in the cache

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: 13.9846470766667 minutes left until token in cache expires

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: 13.9846470766667 minutes left until token in cache expires

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 9/5/2019 9:23:21 PM +00:00

DEBUG: [ADAL]: Information: 2019-09-05T21:09:22.3611754Z: 3562b756-d8eb-4c21-8062-bf4f818e18ae - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 9/5/2019 9:23:21 PM +00:00Access Token Hash: zUlnEMozKR95opjpOGp77VyhuUgaXNuf8DkqzWE0qxY=
         User id: ec3c28fc-ae80-41f5-ac72-e5cff6a09894

DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '09/05/2019 21:23:21 +00:00', MultipleResource? 'True', Tenant: 'c1e0b6a1-e090-4c0a-b206-30f26baf583d', UserId: '[email protected]'
DEBUG: [Common.Authentication]: User info for token DisplayId: '[email protected]', Name: Joe Zuchora, IdProvider: 'https://sts.windows.net/f9796dfa-f91c-4095-8663-e77a96f2d645/', Uid: 'ec3c28fc-ae80-41f5-ac72-e5cff6a09894'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '09/05/2019 21:23:21 +00:00' Comparing to '09/05/2019 21:09:22 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:13:59.0658596'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Automation/automationAccounts/aaBoydcorp/softwareUpdateConfigurations/2019-09 Maintenance Step1-Update Management Machine?api-version=2017-05-15-preview

Headers:
x-ms-client-request-id        : 49c51279-3103-4909-8234-54d653e7b7b0
accept-language               : en-US

Body:
{
  "properties": {
    "updateConfiguration": {
      "operatingSystem": "Windows",
      "windows": {
        "includedUpdateClassifications": "Unclassified,Critical,Security,UpdateRollup,FeaturePack,ServicePack,Definition,Tools,Updates",
        "rebootSetting": "IfRequired"
      },
      "duration": "PT3H",
      "azureVirtualMachines": [
        "/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Compute/virtualMachines/vmBoydcorpMan"
      ]
    },
    "scheduleInfo": {
      "startTime": "2019-09-05T18:00:00-04:00",
      "expiryTime": "9999-12-31T18:59:59.9999999-05:00",
      "expiryTimeOffsetMinutes": 0.0,
      "isEnabled": false,
      "nextRunOffsetMinutes": 0.0,
      "frequency": "Onetime",
      "timeZone": "America/New_York",
      "creationTime": "0001-01-01T00:00:00-05:00",
      "lastModifiedTime": "0001-01-01T00:00:00-05:00"
    },
    "tasks": {}
  }
}


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Created

Headers:
Pragma                        : no-cache
x-ms-request-id               : f057f94c-7552-43a2-8ef9-c29127aaf8df
x-ms-location                 : https://management.azure.com/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Automation/automationAccounts/aaBoydcorp/softwareUpdateConfigurations/2019-09%20Maintenance%20Step1-Update%20Management%20Machine?api-version=2017-05-15-preview
ocp-location                  : https://management.azure.com/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Automation/automationAccounts/aaBoydcorp/softwareUpdateConfigurations/2019-09%20Maintenance%20Step1-Update%20Management%20Machine?api-version=2017-05-15-preview
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id   : be634ec2-f87b-43cf-8c85-c27d721c3ac0
x-ms-routing-request-id       : CANADAEAST:20190905T211128Z:be634ec2-f87b-43cf-8c85-c27d721c3ac0
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Thu, 05 Sep 2019 21:11:27 GMT
Location                      : https://management.azure.com/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Automation/automationAccounts/aaBoydcorp/softwareUpdateConfigurations/2019-09%20Maintenance%20Step1-Update%20Management%20Machine?api-version=2017-05-15-preview
Server                        : Microsoft-IIS/10.0
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "id": "/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Automation/automationAccounts/aaBoydcorp/softwareUpdateConfigurations/2019-09 Maintenance Step1-Update Management Machine",
  "name": "2019-09 Maintenance Step1-Update Management Machine",
  "type": null,
  "properties": {
    "updateConfiguration": {
      "operatingSystem": "Windows",
      "windows": {
        "includedUpdateClassifications": "Critical, Security, UpdateRollup, FeaturePack, ServicePack, Definition, Tools, Updates",
        "excludedKbNumbers": null,
        "includedKbNumbers": null,
        "rebootSetting": "IfRequired",
        "IsInvalidKbNumbers": false
      },
      "linux": null,
      "targets": null,
      "duration": "PT3H",
      "azureVirtualMachines": [
        "/subscriptions/aa567e9f-b082-47e8-a1ee-05a0b9e211ad/resourceGroups/RGBOYDCORP/providers/Microsoft.Compute/virtualMachines/vmBoydcorpMan"
      ],
      "nonAzureComputerNames": null
    },
    "scheduleInfo": {
      "description": null,
      "startTime": "2019-09-05T22:00:00-04:00",
      "startTimeOffsetMinutes": -240.0,
      "expiryTime": "2019-09-05T22:00:00-04:00",
      "expiryTimeOffsetMinutes": -240.0,
      "isEnabled": true,
      "nextRun": "2019-09-05T22:00:00-04:00",
      "nextRunOffsetMinutes": -240.0,
      "interval": null,
      "frequency": "OneTime",
      "creationTime": "2019-09-05T17:11:28.273-04:00",
      "lastModifiedTime": "2019-09-05T17:11:28.273-04:00",
      "timeZone": "America/New_York",
      "advancedSchedule": null
    },
    "provisioningState": "Provisioning",
    "createdBy": "{scrubbed}",
    "error": null,
    "tasks": {
      "preTask": null,
      "postTask": null
    },
    "creationTime": "2019-09-05T17:11:28.277-04:00",
    "lastModifiedBy": null,
    "lastModifiedTime": "2019-09-05T17:11:28.303-04:00"
  }
}


DEBUG: AzureQoSEvent: CommandName - New-AzAutomationSoftwareUpdateConfiguration; IsSuccess - True; Duration - 00:00:10.4711907; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 5:09:28 PM - NewAzureAutomationSoftwareUpdateConfiguration end processing.
DEBUG: 5:09:28 PM - NewAzureAutomationSoftwareUpdateConfiguration end processing.

Error output


joezuchora avatar Sep 05 '19 21:09 joezuchora

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @zjalexander

ghost avatar Sep 06 '19 09:09 ghost

Ok, I spoke to the developers. This is technically intentional because many users do not expect PowerShell to pass in DateTimeOffset, but clearly the behavior here is not any better. I filed an internal tracking bug (5312306) for this but it needs to be prioritized against other work. We don't have an ETA for this right now. Let me look into our documentation and be sure it expresses the correct behavior.

zjalexander avatar Sep 10 '19 00:09 zjalexander

Ok, I spoke to the developers. This is technically intentional because many users do not expect PowerShell to pass in DateTimeOffset, but clearly the behavior here is not any better. I filed an internal tracking bug (5312306) for this but it needs to be prioritized against other work. We don't have an ETA for this right now. Let me look into our documentation and be sure it expresses the correct behavior.

Thank you @zjalexander! Some updated examples would be really helpful in the meantime.

joezuchora avatar Sep 10 '19 12:09 joezuchora

I have an open ticket with Microsoft for this issue as well. I need to open a new one I found today with the -RebootSettings for Linux schedules. No matter what value you give -RebootSettings, it always sets it to the default IfRequired. Anyway, thanks for the detailed GitHub post. I am hoping they fix this soon.

kristopherjturner avatar Sep 12 '19 22:09 kristopherjturner

Sorry for the delay @jzuchora87 - had to wrap my head around this. Now that I got it I am asking the writers to update the docs as well.

You can pass in UTC and no timezone. So to get it working:

$startTime = ((Get-Date).AddMinutes(10)).ToUniversalTime()
$rg = "resourcegroup"
$aa = "automationaccount"
$guid = New-Guid
$schedule = New-AzAutomationSchedule -ResourceGroupName $rg `
    -AutomationAccountName $aa `
    -Name ("OFFSETTIME-"+ $guid ) `
    -StartTime $startTime `
    -OneTime `
    -ForUpdateConfiguration


$target = "/subscriptions/xxx-xxx-xxx-xxx/resourceGroups/ContosoMgmt/providers/Microsoft.Compute/virtualMachines/vm1"
$sucOffset = New-AzAutomationSoftwareUpdateConfiguration `
-Schedule $schedule `
-Windows `
-ResourceGroupName $rg `
-AutomationAccountName $aa `
-AzureVMResourceId $target `
-Duration (New-TimeSpan -Hours 2) `
-RebootOnly

Write-Output "Start time: $startTime"
Write-Output "ScheduleConfiguration: $($sucOffset.ScheduleConfiguration.StartTime) "

Which finally gives me a schedule configuration which is 7 hours ahead but in the +0 timezone for UTC:

Start time: 09/25/2019 21:07:02
ScheduleConfiguration: 09/25/2019 21:07:00 +00:00 

e: played around to make it a bit simpler

zjalexander avatar Sep 25 '19 20:09 zjalexander

I had problems creating a schedule in UTC+2 for a fixed day of the month. The desired time (01:00) would be set to 23:00 when being converted to UTC while the day would stay the same since it is fixed (second Thursday of the month). That would result in the schedule time being 2020-05-14 23:00 instead of 2020-05-14 01:00. Here is my solution, maybe it will help someone else:

$TestSchedule = New-AzAutomationSchedule -ResourceGroupName "HHA_CENTRAL_CORE_AUTO_1" `
    -AutomationAccountName "HHA-CENTRAL-CORE-AUTO-ACC-1" `
    -Name "Test2" `
    -StartTime (Get-Date "01:00+00:00").AddHours(24) `
    -DayOfWeekOccurrence "Second" `
    -DayOfWeek "Thursday" `
    -MonthInterval 1 `
    -ForUpdateConfiguration `
    -TimeZone "Europe/Berlin"

timbehh avatar May 05 '20 06:05 timbehh

PG team is actively looking into this issue and will provide update once it is fixed.

vikram-m avatar Aug 16 '20 12:08 vikram-m

Currently, team is busy with other high priority items and this would be picked up in CY2021 Q1.

vikram-m avatar Nov 16 '20 09:11 vikram-m

Any update on this? This still seems to be an issue with the current Az module v5.5.0 Also is there a way to query for a list of valid TimeZone strings that can be used with this command? I am trying to use the Windows Time Zone IDs from [System.TimeZoneInfo]::GetSystemTimeZones() but it is ignored and the schedules are converted to UTC.

bwarren18 avatar Feb 23 '21 21:02 bwarren18

Any update?

rachaelsingleton avatar Sep 08 '21 21:09 rachaelsingleton

@vikram-m Do you have any updates on this issue.

SaurabhSharma-MSFT avatar Nov 15 '21 23:11 SaurabhSharma-MSFT

The schedule's time zone is working fine now. The start time in debug info response is shown by adding the current time zone of the user.

You can check the actual schedule config using - $suc1 = New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $rgName -AutomationAccountName $aaName -Schedule $sch1 -Windows -AzureVMResourceId $cidl3 -IncludedUpdateClassification $updates -Duration $duration $suc1.ScheduleConfiguration

You can also check the schedule start time in the softwareUpdateConfigurations using this api. - https://docs.microsoft.com/en-us/rest/api/automation/software-update-configurations/get-by-name?tabs=HTTP

Jassingh819 avatar Aug 16 '22 15:08 Jassingh819