Azure / Azure/azure-powershell

[Eng]: New-AzPolicyDefinition converts string value in policyRule to date, in a format that is not compatible with Azure Machine Learning Scheduler

Open
#18,237 7 comments 0 reactions 0 assignees View on GitHub
customer-reported needs-team-attention Policy question Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

When we are passing a json file which has a date as string in yyyy-MM-ddTHH:mm:ss format in policyRule, the New-AzPolicyDefinition is converting it to date object with yyyy-MM-ddTHH:mm:ss**Z** format. This policy is supposed to append a shutdown scheduler to Azure machine learning VMs. The scheduler does not recognize this new format.

Expected behavior: Leave the content of the json file as it is, without parsing the string as date.

Here is example of PolicyRule, where startDate is being converted to date with 'Z' at the end:

"policyRule": {
"if": {
"allOf": [
{
"field": "Microsoft.MachineLearningServices/workspaces/computes/computeType",
"equals": "ComputeInstance"
},
{
"field": "Microsoft.MachineLearningServices/workspaces/computes/schedules",
"exists": "false"
}
]
},
"then": {
"effect": "append",
"details": [
{
"field": "Microsoft.MachineLearningServices/workspaces/computes/schedules",
"value": {
"computeStartStop": [
{
"triggerType": "Cron",
"cron": {
**"startTime": "2022-05-02T00:00:00",**
"timeZone": "UTC",
"expression": "[parameters('cronExpression')]"
},
"action": "Stop",
"status": "Enabled"
}
]
}
}
]
}
}

Contributor guide

Open the contributing guide

Research direction

Start by tracing New-AzPolicyDefinition's handling of the policyRule JSON, using the provided startDate example to reproduce the conversion. Identify where the string gains the trailing Z and verify that the completed change preserves the input date string unchanged for Azure Machine Learning scheduler policies.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.