January 2023

Connect PowerApps with AWS RDS Postgres DB

If you are building apps in PowerApps (No-Code /Low-Code framework) then you may require to connect multiple data sources like SharePoint List, Dataverse Table, Cloud storage like Azure SQL Database etc.  As PowerApps is part of Office 365 family products and powered by Azure. It would be easy for Developers to connect to various Data Sources within Microsoft or Azure Eco-System.

What if requirement arise to connect to Data Storage in another Cloud Provider e.g. AWS or GCP. Well that is also possible. Let’s say there is need to connect to AWS RDS Postgres Database with PowerApps, then you don’t need to move database in Azure Cloud infact you can directly connect with AWS RDS.

First you need to create new custom Connection for AWS RDS DB and then use that Connection in PowerApps to connect Postgres DB tables.

Please watch this video for step by step process to do that.

Connect Non Azure VM or AWS VM with Azure Automation Account

If you the Cloud Support Engineer and handling day to day Cloud Operations then it would be obvious that you would be doing Patching and Installation of VM updates.

As we know Azure provides an option to handle auto installation of updates at the scale with help of Automation Account. You can not only handle updates installation for Azure VMs, but also for Non-Azure VM like VM from other Cloud provider AWS and GCP (Multi-Cloud), On-Premise VMs etc. Here are the steps to connect AWS VM with Azure Cloud

1. Setup Automation Account
  • Go to the Azure Portal https://portal.azure.com/
  • Create new Automation Account
  • Once done, go inside the newly create Automation Account
  • In left hand side menu select ‘Update Management’
  • We need to create Log Analytics workspace, basically it captures all log data from Virtual Machines and send it to workspace.
  • Select ‘Create New Workspace’ in drop down and click Enable button
  • It will take approx. 5 mins to setup new Workspace.
2. Get Log Analytics Workspace Details
  • You would need to get agent details from Workspace
  • Go to the Workspace created in Step 1
  • In left hand side menu select ‘Agents management’
  • Based upon the type of OS (Windows/ Linux), download the agent installation file
  • Also, copy 3 important details i.e. Workspace ID, Primary Key, Secondary Key
3. Install Agent on Non-Azure VM
  • Let’s create new Windows Machine in AWS Cloud
  • Login to Virtual Machine
  • We need to install agent which was downloaded in Step 2
  • Copy agent file MMASetup-AMD64.exe to AWS VM
  •  Click on exe file and start installation process
  • Follow the instructions, click on ‘Connect the agent to Azure Log Analytics’ option
  • Insert the Workspace ID, Primary Key which you had copied in Step 2, click Next
  • Finish the installation

Come back to the ‘Update management’ option with Automation Account. If you notice, it has already started detecting that one new VM is connected and sending logs to Log Analytics Workspace. Just click on ‘Click to manage machine’. 

This is EC2 VM, just click on Enable button

It will take approx 45 mins for AWS VM to show up in Azure Update Management and from there you can monitor status, compliance, schedule updates deployment to AWS VM. Please note Platform is Non-Azure and OS is Windows

This is one the the multi-cloud scenario. Happy learning!!

Call OpenAI API using PowerApps and Power Automate

In this blog post, I will demonstrate how to consume OpenAI API from PowerApps via PowerAutomate. It will be kind of ChatGPT3 experience where user can put forward any question in PowerApps, OpenAI will answer that.

Before we begin this, I would highly recommend to go through my first blog on OpenAI account setup and how to create API Key.

Here is the URL – https://kloudscoop.com/getting-started-with-openai-api-and-postman/

1. Create New Flow in PowerAutomate
  • Go to the PowerAutomate
  • Create new ‘Instant cloud flow’ 
  •  Initialize the variable, this would be the question which will get passed from PowerApps.
  •  Next insert HTTP action, which will call to OpenAI end point. In Header section put Authorization – Bearer Token and in Body section pass on the JSON as shown below. Please note here prompt would be the dynamic question variable initialized above.
  • Finally return respose to PowerApps, this is the response or answer which we will get from OpenAI API.
  • You need to parse JSON and the experssion would be outputs(‘Q&AAPI’)?[‘body’]?[‘choices’][0]?[‘text’]
  • Save the Flow
2. Create New PowerApps
  • Go to the PowerApps and create new App
  • Note: We will not go in detail/step by step process to create PowerApps we will stick to the purpose of this Post.
  • Add 3 lables (Question, Answer and one lable to populate answer from OpenAI ), textbox (ask the question) and button
  • On click of button i.e. on OnSelect property call your PowerAutomate Flow as shown below and in parameter pass question from textbox
  • Save the PowerApps. You are done.
  • Now let’s the magic begin!!
  • See this video, where OpenAI is answering our questions on Classification, Translation, General questions

Getting Started with OpenAI API and Postman

Recently there is a big wave about Artifical Intelligence from Open AI, you may see people have started talking about Chat GPT-3 (Generative Pre-training Transformer). As name suggest it is one of the largest language Pre-Trained model which uses deep learning to produce human like answers.

Did you Know?

Open AI’s GPT-3 is the largest Language Model having 175 BN parameters, 10x more than that of Microsoft’s Turing NLG

In this article I will show you the process to leverage Open AI APIs, so let’s begin:

1. Create New Account on OpenAI web site
 2. Get API Keys
  • Click on Personal menu link in top right ribbon 
  • Click on ‘View API keys’
  • Click on ‘Create new secret key’ button, it will generate new API secret key
  • It will generate new API key, something like in this format sk-<random text>. Copy this key and keep at safe place. You would need this to call OpenAI APIs
  • Important Note: As of writing this blog, OpenAI does not provide official API for ChatGPT. One can use an existing models to get answers that are somewhat similar to the ChatGPT capabilities: Davinci.
3. Call OpenAI API with Postman
  • Open Postman Application
  • Enter URL as https://api.openai.com/v1/completions
  • Select POST HTTP method
  • In Authorization tab, select TYPE as ‘Bearer Token’
  • Paste API key (from Step 2) in token field
  • Now we need to send query/prompt in API body, so to do that select Body tab, select raw format as JSON and paste your JSON like this.
  • In this example we are using text-davinci-003 model and asking it to correct English Grammer in given sentense
  • Once done, click on Send button
  • The JSON response will return sentense with correct English Grammer.
Congratulations!! with this you learned how to consume OpenAI API using Postman client. Similarly you can explore many more features on OpenAI website on examples page. 
This includes Classification, Translation, Code etc.