---
sourceDocument: Yokohama IT Operations Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/it-operations-management

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama IT Operations Management

ft:clusterId :

    - itom

bundleId :

    - itom

workflow :

    - Technology


---

# Cloud policy example

# Cloud policy example {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read

A base system cloud policy, Lease End ServiceNow, uses the on Lease end trigger that fires when a virtual resource is near the lease end date. If the conditions in the policy
rule are met, the policy engine sends a notification to the owner of the resource and performs operations on the resource.

## Before you begin

Role required: sn_cmp.cloud_governor or admin

## About this task

In this example, you work with the Lease End ServiceNow policy. The policy performs the following actions when the conditions in the policy rule are met:

* Send a notification to the owner of a cloud resource when the resource lease is about to expire.
* Run a Stop operation on the resource.
* Run a Deprovision operation on the resource.
{#policy-walkthrough__ul_u23_4zj_jfb}  
You can change any base-system policy by modifying settings or making the policy active or inactive.  
Note:  
Scheduled Start/Stop operations are not supported on the Terraform template and the Google Deployment Manager (GDM) stacks.

## Procedure

1. In the Cloud Admin Portal, navigate to GovernPolicies.
2. Search for and open the Lease End ServiceNow policy.
3. Notice that the trigger is on Lease end, which means that the policy is triggered when the lease for the resource is near expiration.  
4. Sort the Rules related list by Order of Execution.  
   The rule with the lowest number runs first.  

   Notice that a notification rule runs first, followed by the Stop and Deprovision operations on the resource.
5. Click the Notify about upcoming lease end rule.
6. Notice that the rule specifies a condition: If it is one day before the end date, return `true`.  
7. In the Policy Rule Actions related list, click the (empty) Name of the action.
8. On the Update Action pop-up window, enter an Action Name (the value is required), notice the value of the Notification (you will use it in the next step), and then close the pop-up window.  
9. Review the notification message other settings:
   1. On the instance (not the Cloud Admin Portal), navigate to System NotificationEmailNotifications.
   2. Search for and open the notification that is specified in the action by entering the filter text <kbd class="ph userinput">*Upcoming lease end</kbd> for Name:  
   3. Click Upcoming lease end to open the notification form.  
      Notice that the Scheduled Operations \[sn_cmp_scheduled_operation\] table is specified.  
      Note:  
      You base all notifications for Cloud Provisioning and Governance on this table.
   4. On the When to send tab, notice the conditions that apply:  
      {#policy-walkthrough__table_bvl_gp3_jfb__entry__2}

      | Condition | Description |
      |-|-|
      | Operation Type is Notification | Specifies that the Operation Type field on the Scheduled Operations table must be Notification. |
      | Status | Specifies that the system should trigger the notification when the status of the scheduled operation record is in progress, rather than waiting until it is complete. |
      | Notification | Specifies that the Upcoming lease end notification must be specified. |
      [ ]

      {#policy-walkthrough__table_bvl_gp3_jfb}  
      Note:  
      When you create a custom notification, use the default conditions, but change the Notification condition to the name of your notification.
   5. Click the Who will receive tab.  
      Notice that the Users/Groups in fields value is set to <kbd class="ph userinput">Target.Assigned to</kbd>, <kbd class="ph userinput">Target.Owned by</kbd>. You should use these settings to send the notification
      to the owner of the virtual resource.
10. In the Cloud Admin Portal, open the Lease End ServiceNow policy again, and then open the Stop on lease end rule.  

    The rule has two actions --- one action to send a notification and the other action to run the Stop operation on the virtual resource.
11. Click the (empty) Action Name of the action for the Stop operation.  
12. On the Update Action pop-up window, notice the settings:  
    {#policy-walkthrough__table_gyk_jpj_jfb__entry__2}

    | Field | Description |
    |-|-|
    | Policy and Rule Name | The policy and the rule to which this action belongs are specified in these fields by default. |
    | Action Type | Run An Operation tells the policy engine to trigger a standard operation (Start, Stop, Deprovision, and so on) on the resource. |
    | Blueprint Operation | The system runs the STOP operation on the resource. |
    [ ]

    {#policy-walkthrough__table_gyk_jpj_jfb}

    The other rule, Deprovision after lease end, performs the Deprovision operation on the resource so that it does not stay active after the lease end date.

## What to do next

This example uses the settings available through the form configuration. To see example scripts that you could use in addition, see [Create a policy action script](https://servicenow-prod.fluidtopics.net/HJokDoCw~8BcEZtW_W13Zw "Use policy action scripts to get, update, or set values in cloud requests.").

*[\>]: and then


