John Liu Blog

Every drop counts

Data API Builder notes

Docker Desktop We can deploy Data API Builder (DAB) using Docker Compose in Docker Desktop. An example compose file: version: '3' services: DAB-AutoGen: image: "mcr.microsoft.com/azure-databases/data-api-builder:latest" container_name: DAB-AutoGen ports: - "5002:5000" extra_hosts: - "host.docker.internal:host-gateway" volumes: - c:\DataAPIBuilder\Samples\:/App/DAB-Configs command: ["--ConfigFileName", "/App/DAB-Configs/dab-config-AutoGen.json"] DAB-AutoGen2: image: "mcr.microsoft.com/azure-databases/data-api-builder:latest" container_name: DAB-AutoGen2 ports: - "5003:5000" extra_hosts: - "host.docker.internal:host-gateway" volumes: - c:\DataAPIBuilder\Samples\dab-config-AutoGen.json:/App/dab-config.json Azure Container Instance We can also deploy the container in Azure Container Instance (ACI). The DAB configuration files need to be store in Azure File Share.

Azure Cosmos DB study notes

TTL (time-to-live): max 2,147,483,647seconds (~68years) For TTL to work at either container or item level, it needs to be enable/configured at container level first. If only configured at item level, it will be ignored unless TTL is enabled/configured at container level default TTL is not configured max configureable TTL is ? Previsioned throughput vs. serverless: previsioned throughput is ideal for predictable traffic patterns that require sustained and predictable performance with minimal variance Serverless can handle wildly varying traffic and low average-to-peak traffic ratios

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”.