Posts Tagged - azure

Azure Functions - Fundamentals

Files that compose an Azure Function:

  • a Readme file
  • function.json -> this is an important file. it defines each Azure function in a function App. It specifies things like what event triggers this function, HTTP methods, auth, etc.
  • run.csx

How to create an Azure Function

Create a resource -> Compute -> Function App.

The function name has to be unique.
Create new resource group.
You can choose the OS.

Storage:
Create a new recommended storage.
It offers to create an application insight instance for us. This stores logs and diagnostic information. This is really recommended.

On Configuration > Application settings you can create sys envs which will appear in your code.

There’s a storage explorer where you may see the contents for your function in real time.

Understanding Triggers and Bindings

There’re a lot of trigger types

  • Timers, HTTP requests
  • Queue messages, blobs, Comsos DB

Input / Output Bindings

  • Connect to external resources
  • Reduce amount of code

To work with Azure Functions, you may work with Visual Studio. There’s an option to enable “Azure Development” with which you’ll be able to project and run your functions locally.

Read More

Azure Functions - Introduction

Azure Functions are based in serverless programming. They integrate easily with other Azure services. You provide Code to execute and an event that triggers it.
For example to run background tasks every hour.

They’re brilliant for:

  • experiments and rapid prototyping.
  • automating development processes.
  • decomposing or extending monolithic apps.
  • independent scaling.
  • adapters for integrating systems.

Recommended Read

Azure Functions vs other similar services

Azure Functions is built on top of the web jobs SDK and it’s hosted on the app service platform.

Virtual Machines (IaaS)

With VM you can install whatever you want: web servers, services etc. This is known as IaaS (infrastructure as a service). You can choose OS and have complete control of the server, but you’re responsible for it: Patching, maintaining, scaling, operational overhead.

Read More

Azure CosmosDB Query Examples

This are examples of queries to use for Azure CosmosDB, as this database uses a restricted version of SQL and it doesn’t allow all queries or joins.

Partial queries

To be used with the main, partial query. This query starts with something such as SELECT * FROM c

WHERE c.ts LIKE "%2022/03/10%" 
ORDER BY c.ts DESC
WHERE c.type = "Writeable" 
AND c.ts LIKE "%2022/03/10, 15:2%" 
ORDER BY c.ts DESC

Full queries

Normal SQL queries to be used as custom queries. Note that CosmosDB doesn’t support a 100% of all SQL statements.

(count number of entries)

SELECT COUNT(1) FROM c 
	WHERE c.ts LIKE "%2022/03/10%" 
	ORDER BY c.ts DESC

Read More