Azure / Azure/azure-powershell
New-AzAutomationSchedule or Get-AzAutomationSchedule do not handle Minute frequency
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
Azure Rest Api allow creation of automation's schedule with a frequency of Minute (Please see : https://learn.microsoft.com/en-us/rest/api/automation/schedule/create-or-update?tabs=HTTP#schedulefrequency)
1. New-AzAutomationSchedule do not allow that. Which seems to be a missing feature.
2. If you create a Minute schedule with API, Get-AzAutomationSchedule complain : Get-AzAutomationSchedule: Requested value 'Minute' was not found.
Please make New-AzAutomationSchedule or Get-AzAutomationSchedule handle "Minute" frequency
### Issue script & Debug output
```PowerShell
DEBUG: 11:15:28 - GetAzureAutomationSchedule begin processing with ParameterSet 'ByName'.
DEBUG: 11:15:28 - using account id 'MyUPN'...
DEBUG: 11:15:28 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'MyUPN', environment: 'AzureCloud', tenant: 'MyTenantID'
DEBUG: 11:15:28 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'MyTenantID', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'MyUPN'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 27ea39e6-f672-4200-8586-dfa468714b3b] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 27ea39e6-f672-4200-8586-dfa468714b3b] [Region discovery] Not using a regional
authority.
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 27ea39e6-f672-4200-8586-dfa468714b3b] [Region discovery] Not using a regional
authority.
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 27ea39e6-f672-4200-8586-dfa468714b3b] [Region discovery] Not using a regional
authority.
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 27ea39e6-f672-4200-8586-dfa468714b3b] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 27ea39e6-f672-4200-8586-dfa468714b3b] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60] Found 2 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60] Returning 2 accounts
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] MSAL MSAL.NetCore with assembly version
'4.39.0.0'. CorrelationId(768d1a8e-6dbc-4994-ad30-02d1ac9d5705)
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] LoginHint provided: False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] Account provided: True
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.60 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] ForceRefresh: False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705
UserAssertion set: False
LongRunningOboCacheKey set: False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] === Token Acquisition (SilentRequest) started:
Scopes: https://management.core.windows.net//.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] [Region discovery] Not using a regional
authority.
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] Access token is not expired. Returning the found cache entry. [Current time (01/25/2023 10:15:28) - Expiration Time (01/25/2023 10:38:41 +00:00) - Extended Expiration Time (01/25/2023 10:38:41 +00:00)]
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] [Region discovery] Not using a regional
authority.
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] Fetched access token from host login.microsoftonline.com.
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.0 Microsoft Windows 10.0.19044 [01/25 10:15:28.61 - 768d1a8e-6dbc-4994-ad30-02d1ac9d5705] AT expiration time: 25/01/2023 10:38:41 +00:00, scopes https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default source Cache from login.microsoftonline.com appHashCode 11057527
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2023-01-25T10:38:41.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'MyTenantID', UserId: 'MyUPN'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/MySubID/resourceGroups/MyRGP/providers/Microsoft.Automation/automationAccounts/MyAutomationAccount/schedules/PDA_test_FluxtestMin?api-version=2020-01-13-preview
Headers:
Accept-Language : en-US
x-ms-client-request-id : 5699b2a9-a56b-4b9e-a719-1ddccb52db58
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-request-id : 5699b2a9-a56b-4b9e-a719-1ddccb52db58
Server : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11993
x-ms-correlation-request-id : e09772d7-e1d6-4648-871f-64a6fa8d7c32
x-ms-routing-request-id : UKWEST:20230125T101529Z:e09772d7-e1d6-4648-871f-64a6fa8d7c32
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Wed, 25 Jan 2023 10:15:28 GMT
Body:
{
"id": "/subscriptions/MySubID/resourceGroups/MyRGP/providers/Microsoft.Automation/automationAccounts/MyAutomationAccount/schedules/PDA_test_FluxtestMin",
"name": "PDA_test_FluxtestMin",
"type": "Microsoft.Automation/AutomationAccounts/Schedules",
"properties": {
"description": "Test Minute",
"startTime": "2023-01-25T08:32:00+01:00",
"startTimeOffsetMinutes": 60.0,
"expiryTime": "9999-12-31T23:59:59.9999999+01:00",
"expiryTimeOffsetMinutes": 0.0,
"isEnabled": false,
"nextRun": "2023-01-25T11:17:00+01:00",
"nextRunOffsetMinutes": 60.0,
"interval": 15,
"frequency": "Minute",
"creationTime": "2023-01-24T16:42:31.657+01:00",
"lastModifiedTime": "2023-01-24T16:42:32.157+01:00",
"timeZone": "Europe/Paris",
"advancedSchedule": null
}
}
DEBUG: 11:15:28 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Get-AzAutomationSchedule: Requested value 'Minute' was not found.
DEBUG: 11:15:29 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Automation:1.7.4; CommandName: Get-AzAutomationSchedule; PSVersion: 7.3.1; IsSuccess: False; Duration: 00:00:00.6596964; Exception: Requested value 'Minute' was not found.;
DEBUG: Finish sending metric.
DEBUG: 11:15:29 - GetAzureAutomationSchedule end processing.
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 2.10.1 Az.Accounts
Script 1.7.4 Az.Automation
```
### Error output
```PowerShell
Message : Requested value 'Minute' was not found.
StackTrace : at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)
at System.Enum.TryParse(Type enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at Microsoft.Azure.Commands.Automation.Model.Schedule..ctor(String resourceGroupName, String automationAccountName, Schedule schedule)
at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.CreateScheduleFromScheduleModel(String resourceGroupName, String automationAccountName,
Schedule schedule)
at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient.GetSchedule(String resourceGroupName, String automationAccountName, String scheduleName)
at Microsoft.Azure.Commands.Automation.Cmdlet.GetAzureAutomationSchedule.AutomationProcessRecord()
at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.b__3_0(T c)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.ArgumentException
InvocationInfo : {Get-AzAutomationSchedule}
Line : Get-AzAutomationSchedule -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName -Name "PDA_test_FluxtestMin" -Debug
Position : At line:1 char:1
+ Get-AzAutomationSchedule -AutomationAccountName $AutomationAccountNam …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 39
```
Contributor guide
Assessment
This issue has not been assessed yet.