From fac17e5a9901827264f8a85a3f3d0a280f9372d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert=20=28from=20Dev=20Box=29?= Date: Tue, 17 Sep 2024 15:53:31 -0400 Subject: [PATCH] Fixing cron schedule on the dc --- .../content/it-asset-management-policy.md | 9 ++++++++- .../src/functions/connections.ts | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/samples/nodejs-typescript-policies-dc/content/it-asset-management-policy.md b/samples/nodejs-typescript-policies-dc/content/it-asset-management-policy.md index 628de8d..5bae997 100644 --- a/samples/nodejs-typescript-policies-dc/content/it-asset-management-policy.md +++ b/samples/nodejs-typescript-policies-dc/content/it-asset-management-policy.md @@ -40,7 +40,14 @@ This policy applies to all employees, contractors, consultants, temporary and ot - Sensitive data must be securely erased from IT assets before disposal to prevent unauthorized access. - Records of asset disposal must be maintained, including details such as disposal date, method, and recipient. -### 3.5 Security +### 3.5 Asset Refresh + +To ensure that all employees have access to up-to-date and efficient technology, the following device refresh policy is established: + +- **Junior and Senior Roles**: Employees in junior and senior roles are eligible to refresh their devices every four years. +- **Principal and Partner Roles**: Employees in principal roles are eligible to refresh their devices every two years. + +### 3.6 Security - Security measures must be implemented to protect IT assets from unauthorized access, theft, and damage. - Access controls must be established to restrict access to sensitive IT assets. diff --git a/samples/nodejs-typescript-policies-dc/src/functions/connections.ts b/samples/nodejs-typescript-policies-dc/src/functions/connections.ts index 2b347b8..809500a 100644 --- a/samples/nodejs-typescript-policies-dc/src/functions/connections.ts +++ b/samples/nodejs-typescript-policies-dc/src/functions/connections.ts @@ -44,14 +44,18 @@ export async function retractConnection(timer: Timer, context: InvocationContext await deleteConnection(config); } +const currentDate = new Date(); +const cronExpression = `0 0 0 ${currentDate.getUTCMonth()} ${currentDate.getUTCDay()} *`; app.timer('deployConnection', { - schedule: '0 0 0 30 2 *', + // Runs every year + schedule: cronExpression, runOnStartup: process.env.AZURE_FUNCTIONS_ENVIRONMENT === 'Development', handler: deployConnection }); app.timer('retractConnection', { - schedule: '0 0 0 30 2 *', + // Runs every year + schedule: cronExpression, runOnStartup: false, handler: retractConnection });