Cloud policy example

  • Freigeben Version: Australia
  • Aktualisiert 12. März 2026
  • 3 Minuten Lesedauer
  • 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.

    Vorbereitungen

    Role required: sn_cmp.cloud_governor or admin

    Warum und wann dieser Vorgang ausgeführt wird

    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.
    You can change any base-system policy by modifying settings or making the policy active or inactive.
    Hinweis:
    Scheduled Start/Stop operations are not supported on the Terraform template and the Google Deployment Manager (GDM) stacks.

    Prozedur

    1. In the Cloud Admin Portal, navigate to Govern > Policies.
    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.
      on Lease End trigger
    4. Sort the Rules related list by Order of Execution.
      The rule with the lowest number runs first.
      Rules for the policy

      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.
      Condition in the policy rule
    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.
      Sending a notification
    9. Review the notification message other settings:
      1. On the instance (not the Cloud Admin Portal), navigate to System Notification > Email > Notifications.
      2. Search for and open the notification that is specified in the action by entering the filter text *Upcoming lease end for Name:
        Searching for the notification
      3. Click Upcoming lease end to open the notification form.
        Notice that the Scheduled Operations [sn_cmp_scheduled_operation] table is specified.
        Hinweis:
        You base all notifications for Cloud Provisioning and Governance on this table.
        Scheduled Operations table
      4. On the When to send tab, notice the conditions that apply:

        When to send the notification

        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.
        Hinweis:
        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 Target.Assigned to, Target.Owned by. 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.
      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.

      Open the Stop operation action

    12. On the Update Action pop-up window, notice the settings:

      Stop operation

      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.

      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.

    Nächste Maßnahme

    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.