VMware Cloud Community
FrodeGarnes
Contributor
Contributor

vRealize Automation 7.0.1 - Property Definitions - pass in Business Group variable

Hi

Any advice on how to pass on the Business Group name to a vRO action when used as external values on a property definition?

The use case is the property should contain different information based on what Business Group you are currently requesting for.

We have tried to pass on variables from the Fields in vRO but these seems to be passed on as string values (${_asd.requestInfo_~subTenant~name})

Also tried to get info from vRO Action through

var myvCACCAFEInteractionWorkItem = new vCACCAFEInteractionWorkItem() ;

that contains a .getSubtenantRef()  but this one returns null

Hope for any tips.

0 Kudos
10 Replies
Joffer
Enthusiast
Enthusiast

I'm working with Frode on this one and would like to clarify:

While designing XaaS (service blueprints) in vRA7 it works fine to set/configure a constraints 'value' as 'Field' and select "Request Info > Business Group > Name" (see attached image1). This changes for instance our text field from an input to using a vRA "__asd system variable": ${_asd.requestInfo_~subTenant~name} (see image2).

For our VM blueprints we have assigned a 'Property Group' of property definitions that we need the users to choose from when ordering a VM. We need these to be dropdowns for most part, so users are forced to select pre-defined values. For us to populate many of these drop down lists, we have assigned vRO actions to pull/collect data and populate them. But a few of these needs the current Business Group name (or ID) to fetch the correct values. And here we are stuck. The input parameters for actions in vRA only takes "simple" inputs (strings, numbers, booleans etc), not complex as configuration elements or composite types.

Looking at image3, you can see we have tried to use the _asd.requestInfo variable but it seems to be parsed as text instead as a value, at least according to what we see in the logs. Is there a way to "force" vRA VM blueprint property to put the value of ${_asd.requestInfo_~subTenant~name} into our 'bgName' variable or is there another way we can get the current Business Group name into this input parameter? We need it to be dynamic so we can reuse the code for several Business Groups.

0 Kudos
Joffer
Enthusiast
Enthusiast

(btw, the file names are a bit confusing/wrong, but the numbering is correct matching my post)
0 Kudos
GrantOrchardVMw
Commander
Commander

Is it safe to guess that the user may be a member of more than one Business Group?

Grant http://grantorchard.com
0 Kudos
FrodeGarnes
Contributor
Contributor

Yes, we have users that can be part of more than one business group.

0 Kudos
FrodeGarnes
Contributor
Contributor

There must be a way from the vRO actions to see from what context it was called

0 Kudos
Joffer
Enthusiast
Enthusiast

Yes many users would be in several business groups (or project groups as we use them for).

But the users aren't the problem (so far). The blueprint property value will be drop down lists which is populated by vRO actions, and the action needs a dynamic input value, based on, in this case, the business group name (or ID) to get the correct list of data.

0 Kudos
GrantOrchardVMw
Commander
Commander

I'm not sure of the vRO function (I'd need to spend a bit of time looking), but you can return Business Group membership with the following API:

GET https://{{vra-fqdn}}/identity/api/tenants/vsphere.local/principals/cloudadmin@corp.local/subtenants

Example response:

{

  "links": [],

  "content": [

    {

      "@type": "Subtenant",

      "id": "29a02ed9-7e63-4c77-8a15-c930afb0e3d8",

      "name": "Development",

      "description": "test",

      "subtenantRoles": [

        {

          "id": "cb209521-93d9-4f26-90e9-ba2f0b9e42ce",

          "name": "Business Group Manager",

          "scopeRoleRef": "CSP_SUBTENANT_MANAGER",

          "principalId": []

        },

        {

          "id": "9a21018c-0599-457c-9c87-1b6d1b5ea681",

          "name": "Basic User",

          "scopeRoleRef": "CSP_CONSUMER",

          "principalId": []

        }

      ],

      "extensionData": {

        "entries": [

          {

            "key": "iaas-machine-prefix",

            "value": {

              "type": "string",

              "value": "917d0325-ce7c-4c2f-80b5-e7a600152cf9"

            }

          },

          {

            "key": "iaas-manager-emails",

            "value": {

              "type": "string",

              "value": "DevMgr@corp.local"

            }

          }

        ]

      },

      "tenant": "vsphere.local"

    },

    {

      "@type": "Subtenant",

      "id": "56d0f0b8-b11e-4ea0-ac9b-7a267d5a29d4",

      "name": "Transfer",

      "description": "",

      "subtenantRoles": [

        {

          "id": "70c7fc9b-cad7-4f16-bf2e-c300d72d5959",

          "name": "Basic User",

          "scopeRoleRef": "CSP_CONSUMER",

          "principalId": []

        }

      ],

      "extensionData": {

        "entries": [

          {

            "key": "iaas-ad-container",

            "value": {

              "type": "string",

              "value": ""

            }

          },

          {

            "key": "iaas-manager-emails",

            "value": {

              "type": "string",

              "value": "cloudadmin@corp.local"

            }

          }

        ]

      },

      "tenant": "vsphere.local"

    }

  ],

  "metadata": {

    "size": 20,

    "totalElements": 2,

    "totalPages": 1,

    "number": 1,

    "offset": 0

  }

}

Grant http://grantorchard.com
0 Kudos
Joffer
Enthusiast
Enthusiast

Thats kind of the opposite of what we need. The users are logged into vRA, and they have their membership of different business groups. When the user requests a new VM from a Blueprint VM in one of the BGs we want the name (or ID) of that BG that request belongs to..
0 Kudos
GrantOrchardVMw
Commander
Commander

Ah, they BG from which they request the XaaS item. My bad. Let me think on that one.

Grant http://grantorchard.com
0 Kudos
FrodeGarnes
Contributor
Contributor

Hi Grant

Initially we would have wanted to know from what IaaS item the request was from.

The current approach has been to place a XaaS item in front of the IaaS item:

This allows for two possibilites as we know:

1. Place the action in vRA, XaaS and pass the variable ${_asd.requestInfo_~subTenant~name} to the action.

2. Place a hidden input variable that has the value of ${_asd.requestInfo_~subTenant~name}, and from vRO action refer to the #inputfieldname

0 Kudos