John Liu Blog

Every drop counts

Azure SQL DB call external API

With the introducing of sp_invoke_external_rest_endpoint in Azure SQL DB, it’s possible to directly calling the Azure OpenAI service within the database. Azure OpenAI is in the safe-listed Azure services. For other API service (like common OpenAI) that’s not in the safe-list, you will need to create a wrapper API in the Azure API Management Instance. To invoke external rest endpoint in Azure SQL DB, a few setup steps are required:

Power Platform ADFS Authentication

If you use ADFS authentication in Power Platform, you might “not” be able to create Office365 connection using a different account other than the currently login account via the normal way. When select “Use another account” option, after enter the second account email in the login prompt, it does not ask for password and automatically create the connection using your current login instead. The workaround is when the login prompt Window pop up, instead of enter the account details, copy the URL from the login address bar and paste the URL into Notepad.

Azure Cosmos DB Emulator

We can use Azure CosmosDB emulator to simulate Azure CosmosDB without actually connect to Azure environment. The emulator is running inside a container. To setup the container using the latest image: docker run -it --name cosmosDB -p 8081:8081 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator This will create a container named cosmosDB and the emulator access port is 8081. When .Net code connect to the emulator, you might receive error about “The SSL connection could not be established” and “The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot”.

Azure OpenAI Troubleshooting

Access denied due to Virtual Network/Firewall rules When making calls to your OpenAI deployed model, you may receive following error: “Access denied due to Virtual Network/Firewall rules.” As the error message suggested, check the “Firewalls and virtual networks” setting for you Azure OpenAI in Azure Portal under “Resource Management” –> “Networking”. If the firewalls are configured for “Selected Networks and Private Endpoints”, make sure the IP address of you current computer is allowed to access the network.

Power Automate extract email alias address

One can use Azure PowerAutomate to process files received via email. We can setup one central email account and create different email alias for different client where PowerAutomate only need to mornitor one email account. Howerver, PowerAutomate doesn’t (at the time of this article) expose the alias email address in the Office365 Outlook email action. One solution to address this challenge is to use Azure Function App to extract the alias email address from the email body using Regex.