Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.81k forks source link

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

Open RezaMadi opened 2 years ago

RezaMadi commented 2 years ago

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:ssZ 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" } ] } } ] } }

ghost commented 2 years ago

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

Issue Details
### 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" } ] } } ] } }
Author: RezaMadi
Assignees: -
Labels: `Policy`, `Service Attention`, `question`, `customer-reported`, `CXP Attention`
Milestone: -
RakeshMohanMSFT commented 2 years ago

@RezaMadi Thank you for reaching out, we are looking into it.

RezaMadi commented 2 years ago

@RakeshMohanMSFT Is there any update on this thread?

RakeshMohanMSFT commented 2 years ago

@RezaMadi Unfortunately no update on this yet, let me push it to product team.

ghost commented 2 years ago

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

Issue Details
### 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" } ] } } ] } }
Author: RezaMadi
Assignees: -
Labels: `Policy`, `Service Attention`, `question`, `customer-reported`
Milestone: -
kenieva commented 2 years ago

Azure Policy only supports the Universal ISO 8601 DateTime format.

RezaMadi commented 2 years ago

Thanks @kenieva for the update. Then, clearly there is a mismatch between DateTime format in Azure Policy and AzureML compute instance schedulers. How should we proceed?