I have implemented NextCloud in my environment. I need to design a blueprint and let my clients to send their request to access a 5 GB space on NextCloud environment so I decided to integrate my NextCloud to Active Directory then design a XaaS blueprint that run a custom workflow to add my clients username to a specific group that has already accessed 5 GB on NextCloud.
Before working with Active Directory plugin, I should configure my active directory as an endpoint within the vRealize Automation.
I go to the administration\vRO Configuration\endpoints the select new and choose Active directory and configure it as shown below
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/117-1024x569.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/119-1024x561.jpg)
Our workflow contains 3 parts:
- At the first it reads requested username which is a active directory username (Get vRA Requested User)
- Use username string to search in active directory and seek the exact username in AD:User format (getAdUserByname)
- Try to connect the active directory and join in to the NextCloud group which is already accessed to 5GB space on the NextCloud environment (Add a user to a user group)
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/121.jpg)
In the first part I should write a custom script that read a string username from requested packet so I need to create a workflow in vRO
On the workflow tab I create a folder named NextCloud and create this my workflow within it
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/081-1-1024x679.jpg)
In the next screen I should go to Schema tab
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/082-2-1024x705.jpg)
Now I Should drag a script task to the right window and configure it. I go to the output tab and create a output parameter in string type and named it “vraUser”.
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/085-1024x417.jpg)
In the visual binding tab I connect the vraUser to the output attribute
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/087-1024x394.jpg)
In the Scripting tab I should write the codes below, These codes helps me to fill the vraUser variable with the requested user.
var executionContext = System.getContext();
var vraUser = executionContext.getParameter("__asd_requestedBy");
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/122-1024x472.jpg)
In the 2nd part I build an action to convert username string to AD:User format and reuse it in the future.Here I have shown how to create an action in vRO.
After login to the vRO client I should go to the Design section and select the action tab then right click on the com.vmware.library.microsoft.activeDirectory and select Add action
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/076-1024x372.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/077-1.jpg)
Click on the Scripting tab and enter this code:
user = ActiveDirectory.searchExactMatch("User", username, 1, adHost)[0];
return user;
Now I need to add attributes that needed here for input section.Click on the right arrow
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/078-1-1024x679.jpg)
I should create 2 attributes:
- username (String type) and
- adHost (AD:AdHost
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/106-1024x615.jpg)
Now I need to define Return type, click on void above the right arrow and set it to AD:User
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/105-1-1024x615.jpg)
The action is ready!
First I put my created action next to my script.
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/084-1024x679.jpg)
Drag vraUser to connect to the username I fill the username with my script in the first part ( It contains requested user)
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/089-1024x417.jpg)
I also need to connect ad host from the middle window to the “In Attribute”. Here I need to define the adHost which means Active directory Server.
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/090-1024x394.jpg)
And select Active directory in the “Value” section
![](https://www.vmehrabi.com/wp-content/uploads/2019/04/123.jpg)
Then connect the actionResult to a space in Out Attributes and named it “vraAdUser”
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/125.jpg)
the last part is putting the prepared workflow named “add a user to a user group”.
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/093-1024x679.jpg)
In this section I go and edit this workflow, so I go to the Visual Binding tab and configure it like this:
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/124.jpg)
As shown above I connect user to “vraAdUser” which I configure it before in second part and it has contained the requested user in AD:User type and then connect the group and create an “In attribute” and configure it with NextCloud group.
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/126-1.jpg)
Click OK and save the workflow.
Now I must go and build a XaaS Blueprint in my vRA.
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/127-1024x561.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/135-1024x560.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/136.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/137.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/138.jpg)
Don’t forget to publush your XaaS Blueprint
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/134.jpg)
Now I need to go in catalog item and assign this XaaS Blueprint a service
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/133.jpg)
![](https://www.vmehrabi.com/wp-content/uploads/2019/05/139.jpg)
Mission has completed.