What problem does Citrix solve?

Citrix is a software company that provides virtualization and remote access solutions. Their products allow users to access remote servers, desktops, and applications over the internet, using a device of their choice. This can be useful in various situations, such as when a company wants to provide its employees with access to their work computers from home or a user wants to access their desktop from a different location. Citrix's solutions are designed to make remote access easy and secure while providing users with a high-quality experience.

Challenges in using the Citrix environment

As with any technology, Citrix users may face a variety of challenges. Some common challenges that Citrix users may encounter include the following:

  • A stuck, hung, broken session or unhealthy host.

  • Ability to clear user's sessions or recover them by terminating rogue processes.

  • Reducing Service Desk calls and user downtime.

To address these challenges, Citrix provides support and resources to help users troubleshoot and resolve any issues they may encounter. Also, many free scripts and paid tools are available, but they may need to be fixed. This can cause frustration and impact the brand and user satisfaction. Some companies have even set up a separate Citrix environment to run these scripts, but this can be a waste of resources and can still cause issues with Citrix Workspace reconnection. Overall, it cannot be very easy for users.

How can Microsoft Power Platform solve this problem?

A Citrix Cloud session log-off app can be created using Citrix Cloud API, SharePoint List, Power Apps, Power Automate and Power BI. This app can enable users to get back up and running quickly, reducing reliance on Service Desk and even second-level support teams.

To create the app, first, you will need to create a Power Apps canvas app. Within Power Apps, you can use the "Screen" function to add a screen to design the log-off page. On this page, you can add a button that the user can click to initiate the log-off process.

Citrix-Session-Log-Off-App.png

Next, you will need to use Power Automate to create a flow that will handle the log-off process. This flow should be triggered when the user clicks the log-off button on the Power Apps screen.

To create the flow, you need to use the "HTTP" action to call the Citrix Cloud API. The API endpoint for logging off a session is /cvad/manage/Sessions/{id}/$logoff. You will need to provide the required parameters, such as the session ID, in the request URL and the access token in the headers.

Citrix-Session-Log-Off-App-Flow.png

The HTTP connector has indeed become a premium feature. However, Microsoft has stated that only the flow creator needs to be P1 licensed, and users of the flow do not need to be P1 licensed.

Once the request is made, the flow should check for a successful response from the API. The user will be logged off from their Citrix session if the response is successful. You can use the "Respond to PowerApp" action to display a message to the user indicating that the log-off was successful.

Parsing JSON Payload

The ParseJSON function has been introduced, allowing JSON payloads and Power Apps to work together more efficiently. For example, to parse a JSON response sent via the Power Automate HTTP action in Power Apps, follow these steps:

  • In Power Automate, create a new flow, and add an HTTP action to request the desired API. Set the "Response" field to a dynamic content variable, such as "body".

  • Add a "Compose" action to the flow and set the input to the "body" variable. Then, the "Outputs" field extracts the desired data from the JSON response.

  • In Power Apps, add a "Data table" control to display the parsed JSON data.

  • In the "Data table" properties, set the "Items" field to the output of the "Compose" action in Power Automate. This will display the parsed JSON data in the table.

Using this approach, you can quickly parse a JSON response from an HTTP action in Power Automate and display the data in Power Apps. This can be useful for displaying API data in your app or using it in further calculations or actions.

Securely store and access secrets

Azure Key Vault is a service to store and access secrets securely. For example, to securely access Citrix Cloud API client secret in Power Automate using Azure Key Vault, follow these steps:

  • In Azure Key Vault, create a new secret and securely store the Citrix Cloud API client secret you want to access.

  • In Power Automate, add an action to retrieve the password from Azure Key Vault. To do this, you will need to provide the URL of your Azure Key Vault and the secret name.

  • In the next step of the flow, use the "Compose" action to decrypt the password retrieved from Azure Key Vault. Finally, you can use the "base64ToString" function to convert the encrypted password to plain text.

  • You can now use the decrypted password to connect to an external service using the "HTTP" action.

Using Azure Key Vault to store passwords, you can ensure that they are securely encrypted and can only be accessed by authorized users or services. This helps protect sensitive information and prevent unauthorized access.

Citrix Cloud API Reference

Authenticate to Citrix Cloud

To authenticate to Citrix Cloud via the API, you must use an OAuth2 authentication flow. This involves sending a request to the /cctrustoauth2/root/tokens/clients endpoint, along with your client ID and secret, to obtain an access token. Once you have received an access token, you can include it in the Authorization header of your API requests to authenticate.

You can refer to the Citrix Cloud API documentation for more detailed information and specific examples.

Search for sessions in Citrix Cloud Sessions

To search for a Citrix Cloud session using the API, you will need to send a GET request to the /cvad/manage/Sessions/$search endpoint of the Citrix Cloud API. This endpoint allows you to search for sessions using various filters and query parameters, such as the user ID, session ID, and session state.

You can refer to the Citrix Cloud API documentation for more detailed information and specific examples.

Log off a session in Citrix Cloud Session

To log off a Citrix Cloud session using the API, you will need to send a POST request to the /cvad/manage/Sessions/{id}/$logoff endpoint of the Citrix Cloud API. This endpoint allows you to log off a specific session using its session ID.

You can refer to the Citrix Cloud API documentation for more detailed information and specific examples.

Features

The Citrix log-off Power App can include the following features:

  • Self-log-off: Allows users to log-off their sessions.

  • Managers log-off: If a direct report cannot log-off due to a stuck or unresponsive session, their manager can log in to the Power Apps app and terminate the session on their behalf.

  • Helpdesk agents log-off: If a user cannot log-off their session or if their manager is unavailable, a Helpdesk agent can assist by searching for the user in the organization and terminating the session on their behalf.

These options allow users to log-off their Citrix sessions quickly and easily, ensuring that their work is secure and accessible from other devices.

Bonus

You can capture Citrix session log-off events and build reports using a SharePoint list and Power BI. To set up this, follow these steps:

  • In SharePoint, create a new list to store the log-off events. Add columns for the username, log-off time, and other relevant details.

  • In Power Apps, enable the log-off button to send the session log-off events to a SharePoint list. The button-click event should capture the session's username, log-off time, and any relevant details.

  • Please create a new report in Power BI and connect it to SharePoint's log-off events list. Then, use the data in the list to create visualizations and reports that show the log-off events and any relevant trends or patterns.

Using this approach, you can easily capture Citrix session log-off events and build reports using a SharePoint list and Power BI. This can help you monitor user activity and identify potential issues or improvement areas.

That's it! With just a few simple steps, you can create a Citrix Cloud session log-off app using Citrix Cloud API, SharePoint List, Power Apps, Power Automate and Power BI. This app will make it easy for users to log off from their Citrix sessions remotely, ensuring their work is secure and accessible from any device.

References