How extend the lease beyond the Maximum Lease when there is a Lease Policy in VMware Aria Automation
search cancel

How extend the lease beyond the Maximum Lease when there is a Lease Policy in VMware Aria Automation

book

Article ID: 325811

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

What is a Lease?

Deployments can be configured to automatically expire after a fixed duration. The length of this duration is called the lease.

How to apply a Lease?

A lease can be applied via:

  1. Lease Policy: this will be applied automatically during the deployment creation, and also depending on the criteria, it will also be applied to existing deployments.
  2. Using Day 2 actions.
  3. Using API. 
Once a lease is applied to the deployment, the Deployments UI will show the expiration date:
curl -k --location --request POST 'https://<FQDN_or_regional_endpoint>/deployment/api/deployments/<deploymentid>/requests?apiVersion=2020-08-25' \
--header 'Authorization: Bearer <bearertoken>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "actionId": "Deployment.ChangeLease",
  "inputs": {
    "Lease Expiration Date": "<NEW LEASE_EXPIRY DATE - FORMAT: 2022-09-25T14:50:00.000Z>"
    }
}'

How to modify the Expiration date?

If the Lease was set using Day 2 action or API you can update the Lease via these methods without having any restriction, however, if you used Lease Policy the Change Lease will be limited to the Max Lease Limit and Maximum Total Lease configured in the Lease Policy, if you need to extend the lease more than Maximum Total Lease you will need two steps:

  1. Modify the policy and validate it enforces a new Maximum Total Lease in the deployment.
  2. Then, request the day 2 action Change Lease or use the API to modify the expiry date.

If you want to reduce the lease, update the Lease Policy. The change will be enforced without needing to run a day 2 action or API call.

Note: Keep in mind that before updating a Lease Policy, it is suggested to use the PREVIEW functionality as a policy can modify multiple deployments at the same time.
image.png

Additional information:



Resolution

This article includes the following examples.

  1. Extending the lease further than Max Lease Limit and Maximum Total Lease via UI and API.
  2. Setting the lease to never Expires.

Use case 1. Extending the lease further than Max Lease Limit and Maximum Total Lease via UI and API.

In this example, the deployments were created having a lease policy that limits the lease to 5 days. The goal in this example is to set the expiration date to 3 months.
image.png

Solution

  1. You are required to modify the Lease Policy Maximum values that will allow us to set the expiration date to at least 3 months.

image.png

  1. Click on PREVIEW in order to confirm which deployments will be affected by this Lease Policy Update.

image.png

  1. Then SAVE the policy.
  2. Then the lease can be modified using the day 2 actions or API.

Using the day 2 actions

  1. In the respective deployment select the day 2 action Change Lease.
image.png
  1. Select the desired date.
image.png
  1. Confirm the changes.
image.png

Using the API

  1. Create an Access (bearer) token:
image.png
  1. Capture the deployment ID from the UI.
image.png
  1. Execute the following API.
curl -k --location --request POST 'https://FQDNorRegionalEndpoint/deployment/api/deployments/deploymentid/requests?apiVersion=2020-08-25' \
--header 'Authorization: Bearer bearertoken' \
--header 'Content-Type: application/json' \
--data-raw '{
  "actionId": "Deployment.ChangeLease",
  "inputs": {
    "Lease Expiration Date": "NEW LEASE_EXPIRY DATE-FORMAT: 2022-09-25T14:50:00.000Z"
    }
}'
Where:
  • FQDNorRegionalEndpoint: For on-premises, is the FQDN of VMware Aria Automation Appliance. For SaaS, use the respective Regional Endpoint.
Example:
curl -k --location --request POST 'https://vra.lab.local/deployment/api/deployments/78d0a28c-fd0d-46de-9ebc-045922a58af5/requests?apiVersion=2020-08-25' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjY0NDczMTU2OTMxMzM2NjM0OTAifQ.eyJp(...)c3MiOiJodHRwOi8vaWRlbnRpdHktc2VydmljZS5wcmVsdWRlLnN2Yy5jbHVzdGVyLmxvY2FsOjg
hN4FkEg2tJvxjTPTv1ejEfnEj4jj9Eit4T0E0Kd9wOLxdMr4jp9zorjJmDH2N_GriyWqTegLySBqYirTVXbsbuQ' \
--header 'Content-Type: application/json' \
--data-raw '{
  "actionId": "Deployment.ChangeLease",
  "inputs": {
    "Lease Expiration Date": "2024-01-31T14:50:00.000Z"
    }
}'
  1. ​​​​​​Validate the changes.
image.png

Use case 2. Setting the lease to never Expires.

  1. Delete the related Lease Policy
  2. To set the expiration to never expires, you can do it via day 2 actions or API.
    • Using day 2 actions.
      1. Request the Day 2 action Change Lease leaving the Lease Expiration Date in blank.
image.png
  1. Validate the changes.
image.png
  • Using the API
    1. Create a Access (bearer) token and capture the deployment ID as explain in the Use Case 1, and execute the following API.
curl -k --location --request POST 'https://FQDNorRegionalEndpoint/deployment/api/deployments/deploymentid/requests?apiVersion=2020-08-25' \
--header 'Authorization: Bearer bearertoken' \
--header 'Content-Type: application/json' \
--data-raw '{
  "actionId": "Deployment.ChangeLease",
  "inputs": {
    }
}'