Wednesday, June 2, 2021

Azure Functions Vs Logic Apps

An Azure function is a code triggered by an event whereas an Azure Logic app is a workflow triggered by an event.

Azure Logic App can define a workflow at ease consuming a range of APIs as connectors. These connectors will perform series of actions defined in the workflow. Like Azure Logic Apps, durable Azure Functions can also be used to define workflow in code structure.



Continue Reading →

Azure Functions

Azure Functions allows a piece of code to be deployed and executed without needing server infrastructure, web server, or any configurations. In addition, azure functions can be written in multiple languages such as C#, Java, JavaScript, TypeScript, and Python.

Here are some key concepts related to Azure Functions:

  1. Trigger: A trigger is what causes a function to run. Azure Functions support various triggers, such as HTTP requests, timers, messages from a message queue (like Azure Service Bus or Azure Queue Storage), blob storage events, and more.

  2. Bindings: Bindings are a way to connect input and output data to a function. They simplify the code needed to interact with other Azure services. For example, you can use input bindings to read data from Azure Storage, and output bindings to write data back to it without having to write code for these operations explicitly.

  3. Language Support: Azure Functions supports multiple programming languages, including C#, JavaScript, Python, and more. You can choose the language that best fits your needs and skills.

  4. Durable Functions: This is an extension of Azure Functions that lets you write stateful functions in a serverless environment. It's particularly useful for workflows and scenarios where you need to manage state across multiple function invocations.

  5. Development Tools: You can develop Azure Functions using the Azure Portal, Visual Studio, or other supported IDEs. Azure Functions Core Tools is a set of command-line tools that facilitates local development and testing.

  6. Pricing: Azure Functions pricing is based on the actual execution of functions and the resources consumed by them. You pay only for the compute resources consumed during execution.

To create an Azure Function, you typically follow these steps:

  1. Create a Function App: This is a container for your functions. It provides a way to manage and deploy related functions together.

  2. Create a Function: Once you have a Function App, you can add individual functions to it. Each function can have its own trigger and bindings.

  3. Configure and Test: Configure the function with any necessary settings, including connection strings and other environment variables. Test the function locally before deploying it to Azure.

  4. Deploy: Deploy your function to Azure using the deployment options provided by your development environment.

  5. Monitor and Debug: Azure Functions integrates with Azure Monitor, allowing you to monitor the performance and health of your functions. You can also enable logging and diagnostics to aid in debugging.

Keep in mind that Azure Functions is just one part of the broader Azure ecosystem, and you can integrate functions with other Azure services to build powerful and scalable solutions.

When to use:

Let’s say, you have to send a birthday email to your customers. You’re an ASP.NET web developer. Instead of building a website in ASP.NET, deploy and hosting it on IIS, just for one feature, you can simply write an azure function and put your email login in the function and deploy it on azure cloud. The azure functions will direct connect to your data source, get your customers emails, and send them an email on a scheduled date and time.

Azure functions are best suited for smaller apps have events that can work independently of other websites. Some of the common azure functions are sending emails, starting backup, order processing, task scheduling such as database cleanup, sending notifications, messages, and IoT data processing.

Why use Azure Functions

Here are some of the reasons why you should use azure functions. 

  1. Azure functions are lightweight and serverless.
  2. Azure functions are easier to write and deploy.
  3. Azure functions are fast to execute because there is no large application, startup time, initialization, and other events fired before the code is executed.
  4. Azure functions’ execution is triggered when an event is fired.
  5. Azure functions are compute-on-demand and that is scalable. When demand of execution increases, more resources are allocated automatically to the service and when requests fall, all extra resources and application instances drop off automatically.
  6. Azure functions support multiple programming languages including C#, F#, Java, JavaScript, TypeScript, and Python. You choose your choice of language.
  7. Azure functions do not need any infrastructure and have 0 maintenance.
  8. Azure function can be build, tested, and deployed in Azure portal using a browser.
  9. Azure functions are easy to upgrade and doesn’t affect other parts of the website.
  10. Azure functions use industry standard and can communicate with other APIs, databases, and libraries.

Reference: https://www.c-sharpcorner.com/https://www.serverless360.com/azure-functions


Continue Reading →

Azure Logic Apps

 What is Azure Logic Apps?

Azure Logic Apps is a cloud-based platform for creating and running automated workflows that integrate your apps, data, services, and systems. With this platform, you can quickly develop highly scalable integration solutions for your enterprise and business-to-business (B2B) scenarios.

The following list describes just a few example tasks, business processes, and workloads that you can automate using the Logic Apps service:

  1. Schedule and send email notifications using Office 365 when a specific event happens, for example, a new file is uploaded.
  2. Route and process customer orders across on-premises systems and cloud services.
  3. Move uploaded files from an SFTP or FTP server to Azure Storage.
  4. Monitor tweets, analyze the sentiment, and create alerts or tasks for items that need review.

How logic apps work

In a logic app, each workflow always starts with a single trigger. A trigger fires when a condition is met, for example, when a specific event happens or when data meets specific criteria. 

Following the trigger, one or more actions run operations that, for example, process, handle, or convert data that travels through the workflow, or that advance the workflow to the next step.

For example, the following workflow starts with a Dynamics trigger that has a built-in condition named When a record is updated. The actions include transforming XML, calling a web app that updates data, evaluating a condition that controls which actions to take, and sending an email notification with the results. When the trigger detects an event that meets the condition, the trigger fires, and the actions in the workflow start to run. Each time the trigger fires, the Logic Apps service creates a workflow instance that runs the actions.

You can visually create workflows using the Logic Apps designer in the Azure portal, Visual Studio Code, or Visual Studio. Each workflow also has an underlying definition that's described using JavaScript Object Notation (JSON). If you prefer, you can edit workflows by changing this JSON definition. For some creation and management tasks, Logic Apps provides Azure PowerShell and Azure CLI command support. 

Why use Logic Apps
The Logic Apps integration platform provides prebuilt Microsoft-managed API connectors and built-in operations so you can connect and integrate apps, data, services, and systems more easily and quickly. You can focus more on designing and implementing your solution's business logic and functionality, not on figuring out how to access your resources.

You usually won't have to write any code. However, if you do need to write code, you can create code snippets using Azure Functions and run that code from your workflow. You can also create code snippets that run in your workflow by using the Inline Code action.

References: https://docs.microsoft.com

Continue Reading →

Friday, April 23, 2021

Azure Active Directory

 What is Azure Active Directory?

Azure Active Directory (Azure AD) is Microsoft’s cloud-based identity and access management service, which helps your employees sign in and access resources in:

  • External resources, such as Microsoft 365, the Azure portal, and thousands of other SaaS applications.

  • Internal resources, such as apps on your corporate network and intranet, along with any cloud apps developed by your own organization. For more information about creating a tenant for your organization, see Quickstart: Create a new tenant in Azure Active Directory.

Reference: https://docs.microsoft.comwhatis

Continue Reading →

Friday, April 16, 2021

Azure SQL

 Azure SQL Database is a relational database-as-a-service (DBaaS) hosted in Azure that falls into the industry category of Platform-as-a-Service (PaaS).

  • Best for modern cloud applications that want to use the latest stable SQL Server features and have time constraints in development and marketing.
  • A fully managed SQL Server database engine, based on the latest stable Enterprise Edition of SQL Server. SQL Database has two deployment options built on standardized hardware and software that is owned, hosted, and maintained by Microsoft.

With SQL Server, you can use built-in features and functionality that requires extensive configuration (either on-premises or in an Azure virtual machine). When using SQL Database, you pay-as-you-go with options to scale up or out for greater power with no interruption. SQL Database has some additional features that are not available in SQL Server, such as built-in high availability, intelligence, and management.

Azure SQL Database offers the following deployment options:

  • As a single database with its own set of resources managed via a logical SQL server. A single database is similar to a contained database in SQL Server. This option is optimized for modern application development of new cloud-born applications. Hyperscale and serverless options are available.
  • An elastic pool, which is a collection of databases with a shared set of resources managed via a logical SQL server. Single databases can be moved into and out of an elastic pool. This option is optimized for modern application development of new cloud-born applications using the multi-tenant SaaS application pattern. Elastic pools provide a cost-effective solution for managing the performance of multiple databases that have variable usage patterns.


Continue Reading →

Azure App Services

 Azure App Service enables you to build and host web apps, mobile back ends, and RESTful APIs in the programming language of your choice without managing infrastructure. It offers auto-scaling and high availability, supports both Windows and Linux, and enables automated deployments from GitHub, Azure DevOps, or any Git repo. 

App Service not only adds the power of Microsoft Azure to your application, such as security, load balancing, autoscaling, and automated management. You can also take advantage of its DevOps capabilities, such as continuous deployment from Azure DevOps, GitHub, Docker Hub, and other sources, package management, staging environments, custom domain, and TLS/SSL certificates.

Besides App Service, Azure offers other services that can be used for hosting websites and web applications.

Deploy an ASP.NET Core web app: https://docs.microsoft.com/en-us/azure/app-service/

Deploy an ASP.NET web app: https://docs.microsoft.com/en-us/azure/

Reference: https://docs.microsoft.comhttps://www.youtube.com


Continue Reading →

Autoscale in Microsoft Azure

 Autoscale allows you to have the right amount of resources running to handle the load on your application. It allows you to add resources to handle increases in load and also save money by removing resources that are sitting idle. You specify a minimum and maximum number of instances to run and add or remove VMs automatically based on a set of rules. Having a minimum makes sure your application is always running even under no load. Having a maximum limits your total possible hourly cost. You automatically scale between these two extremes using rules you create.

When rule conditions are met, one or more autoscale actions are triggered. You can add and remove VMs, or perform other actions. 

Azure Monitor autoscale applies only to Virtual Machine Scale SetsCloud ServicesApp Service - Web AppsAPI Management services, and Azure Data Explorer Clusters.

Horizontal vs vertical scaling
Autoscale only scales horizontally, which is an increase ("out") or decrease ("in") in the number of VM instances. Horizontal is more flexible in a cloud situation as it allows you to run potentially thousands of VMs to handle load.

In contrast, vertical scaling is different. It keeps the same number of VMs, but makes the VMs more ("up") or less ("down") powerful. Power is measured in memory, CPU speed, disk space, etc. Vertical scaling has more limitations. It's dependent on the availability of larger hardware, which quickly hits an upper limit and can vary by region. Vertical scaling also usually requires a VM to stop and restart.

References: https://docs.microsoft.com

Continue Reading →

Thursday, April 15, 2021

Azure backup (On Premise)

 Lab on Azure backup

Go to All Services> Storage > Recovery Services Vaults

Provide following information. Name, Subscription, RG, Location


After providing all information click on Create button. It will take some time to create your resource. when It is completed then open this service vault resource. 


Here you will see two option Backup and Site Recovery. So we will first learn Backup of on-premise file on cloud. Click on Backup link. 

In the Backup page, It will ask two question 
1- Where is your Workload running? 
    a- Azure  b- On-Premises   c- Azure-Stack
2- What do you want to backup? 
    (options depend on the above option selected)

So here I will select On-Promises in first drop down and Files and folders in second drop down. and click on Prepare Infrastructure button. 

Here we need to follow instructions given in this page. 

So lets download Recovery service agent and install it in our on-premise system.

download the second option also (Vault credentials).

Now open the Microsoft Azure Backup in your system. (Recovery service agent)


Click on Register Server option Right side Backup section. 

It will open a wizard. In Proxy Configuration nothing to do. click on Next. In Vault Identification tab browse the downloaded vault credential file. and click on Next button. 


In Encryption setting tab, You have to set passphrase. click on Generate Passphrase button. It will generate passphrase for you. you can save this passphrase in any location. finally click on Register button.


Now our system is synchronized with azure.


Now you can see, there is no backup scheduled. Lets schedule a backup. Click on Schedule Backup link. 


Select the files/folder to backup. 

Specify the backup schedule day/time. you can set maximum 3 times per day.

As of now you can skip retention policy.  Choose initial backup type 'Online'. Finally click on finish button. Backup schedule for 8PM per day has been created.

But here we will not wait till that time. So we will click on BackUp now link available on right side.


Backup will take some time based on file size. So you will have to wait. when processing will be done click on Finish button. Now backup is ready. 

Now We will delete all existing files which are backup. 

Now we will Recover the files which we backed Up. Click on Recover data link. select the red marked options below.


In the Select Volume and Date tab you will see the last backup date. select it and  click on Mount button.

It will take some time, till then you will have to wait. 


Finally you can see the data in my computer drive section. 

Continue Reading →

Azure Site Recovery and Backup

 As an organization you need to adopt a business continuity and disaster recovery (BCDR) strategy that keeps your data safe, and your apps and workloads online, when planned and unplanned outages occur.

Azure Recovery Services contributes to your BCDR strategy:

Site Recovery service: Site Recovery helps ensure business continuity by keeping business apps and workloads running during outages. Site Recovery replicates workloads running on physical and virtual machines (VMs) from a primary site to a secondary location. When an outage occurs at your primary site, you fail over to secondary location, and access apps from there. After the primary location is running again, you can fail back to it.

Backup service: The Azure Backup service provides simple, secure, and cost-effective solutions to back up your data and recover it from the Microsoft Azure cloud.

What can I back up?

Azure Backup offers three types of replication to keep your storage/data highly available.

Locally redundant storage (LRS) replicates your data three times (it creates three copies of your data) in a storage scale unit in a datacenter. All copies of the data exist within the same region. LRS is a low-cost option for protecting your data from local hardware failures.

Geo-redundant storage (GRS) is the default and recommended replication option. GRS replicates your data to a secondary region (hundreds of miles away from the primary location of the source data). GRS costs more than LRS, but GRS provides a higher level of durability for your data, even if there's a regional outage.

Zone-redundant storage (ZRS) replicates your data in availability zones, guaranteeing data residency and resiliency in the same region. ZRS has no downtime. So your critical workloads that require data residency, and must have no downtime, can be backed up in ZRS. 

Reference: https://docs.microsoft.com


Continue Reading →

Saturday, April 10, 2021

Azure Storage services

 The Azure Storage platform is Microsoft's cloud storage solution for modern data storage scenarios. Core storage services offer a massively scalable object store for data objects, disk storage for Azure virtual machines (VMs), a file system service for the cloud, a messaging store for reliable messaging, and a NoSQL store. The services are:

  • Durable and highly available. Redundancy ensures that your data is safe in the event of transient hardware failures. You can also opt to replicate data across datacenters or geographical regions for additional protection from local catastrophe or natural disaster. Data replicated in this way remains highly available in the event of an unexpected outage.
  • Secure. All data written to an Azure storage account is encrypted by the service. Azure Storage provides you with fine-grained control over who has access to your data.
  • Scalable. Azure Storage is designed to be massively scalable to meet the data storage and performance needs of today's applications.
  • Managed. Azure handles hardware maintenance, updates, and critical issues for you.
  • Accessible. Data in Azure Storage is accessible from anywhere in the world over HTTP or HTTPS. Microsoft provides client libraries for Azure Storage in a variety of languages, including .NET, Java, Node.js, Python, PHP, Ruby, Go, and others, as well as a mature REST API. Azure Storage supports scripting in Azure PowerShell or Azure CLI. And the Azure portal and Azure Storage Explorer offer easy visual solutions for working with your data.

Core storage services

The Azure Storage platform includes the following data services:

  • Azure Blobs: A massively scalable object store for text and binary data. Also includes support for big data analytics through Data Lake Storage Gen2.
  • Azure Files: Managed file shares for cloud or on-premises deployments.
  • Azure Queues: A messaging store for reliable messaging between application components.
  • Azure Tables: A NoSQL store for schemaless storage of structured data.
  • Azure Disks: Block-level storage volumes for Azure VMs.

Example scenarios

The following table compares Files, Blobs, Disks, Queues, and Tables, and shows example scenarios for each.

DescriptionWhen to use
Azure Files: Offers fully managed cloud file shares that you can access from anywhere via the industry standard Server Message Block (SMB) protocol.

You can mount Azure file shares from cloud or on-premises deployments of Windows, Linux, and macOS.
You want to "lift and shift" an application
to the cloud that already uses the native file system APIs to share data between it and other applications running in Azure.

You want to replace or supplement
on-premises file servers or NAS devices.

You want to store development and
debugging tools that need to be accessed
from many virtual machines.
Azure Blobs: Allows unstructured data to be stored and accessed at a massive scale in block blobs.

You want your application to support streaming and random access scenarios.

You want to be able to access application
data from anywhere.
Azure Disks: Allows data to be persistently stored
and accessed from an attached virtual hard disk.
You want to "lift and shift" applications that use native file system APIs to read and write data to persistent disks.

You want to store data that is not required
to be accessed from outside the virtual
machine to which the disk is attached.
Azure Queues: Allows for asynchronous
message queueing between application components.
You want to decouple application
components and use asynchronous messaging to communicate between them.
Azure Tables: Allow you to store structured
NoSQL data in the cloud, providing a
key/attribute store with a schemaless design.
You want to store flexible datasets like user data for web applications, address books, device information, or other types of metadata your service requires.

References: https://docs.microsoft.com

Azure Storage redundancy

Azure Storage always stores multiple copies of your data so that it is protected from planned and unplanned events, including transient hardware failures, network or power outages, and massive natural disasters.

Redundancy in the primary region

Data in an Azure Storage account is always replicated three times in the primary region. Azure Storage offers two options for how your data is replicated in the primary region:

Locally redundant storage (LRS) copies your data synchronously three times within a single physical location in the primary region. LRS is the least expensive replication option, but is not recommended for applications requiring high availability.

Zone-redundant storage (ZRS) copies your data synchronously across three Azure availability zones in the primary region. For applications requiring high availability, Microsoft recommends using ZRS in the primary region, and also replicating to a secondary region.

Reference: https://docs.microsoft.com

Continue Reading →

Friday, April 9, 2021

Improve Website Response Using Traffic Manager

 This tutorial describes how to use Traffic Manager to create a highly responsive website by directing user traffic to the website with the lowest latency. Typically, the datacenter with the lowest latency is the one that is closest in geographic distance.

Steps to follow for this purpose: 

Create two Virtual network (one in East-Us and other in India)

Now Create two VM in each vnet.


Install IIS in both the VM. Create Index.html file within wwwroot folder in both VM.

Now create two more VM in both Vnet (one in each) for testing the website.

Now configure the DNS name in both VM server. (vmserver-eastUS, vmserver-india)

I provided the name vmserverus.eastus.cloudapp.azure.com in configuration. Same way create DNS for India server also.

Now create traffic manager profile. This time select Routing method as 'Performance'.

Now add endpoints for bothVM in Traffic manager profile. 



Now copy the DNS name from traffic manager profile http://mytmf.trafficmanager.net 

Now all steps are completed. This is the time for testing. 

Go to testing server of US and open the above url in IE. You will see web page from US server. same try to do with India testing server you will see data from India server.

Reference: https://docs.microsoft.com

Continue Reading →

Tuesday, April 6, 2021

Traffic Manager in Azure portal

 Azure Traffic Manager is a DNS-based traffic load balancer. This service allows you to distribute traffic to your public facing applications across the global Azure regions. Traffic Manager also provides your public endpoints with high availability and quick responsiveness.

Traffic Manager uses DNS to direct the client requests to the appropriate service endpoint based on a traffic-routing method. Traffic manager also provides health monitoring for every endpoint. The endpoint can be any Internet-facing service hosted inside or outside of Azure.

Traffic Manager routing methods

Azure Traffic Manager supports six traffic-routing methods to determine how to route network traffic to the various service endpoints. For any profile, Traffic Manager applies the traffic-routing method associated to it to each DNS query it receives. The traffic-routing method determines which endpoint is returned in the DNS response.

The following traffic routing methods are available in Traffic Manager:

  • Priority: Select Priority routing when you want to have a primary service endpoint for all traffic. You can provide multiple backup endpoints in case the primary or one of the backup endpoints is unavailable.
  • Weighted: Select Weighted routing when you want to distribute traffic across a set of endpoints based on their weight. Set the weight the same to distribute evenly across all endpoints.
  • Performance: Select Performance routing when you have endpoints in different geographic locations and you want end users to use the "closest" endpoint for the lowest network latency.
  • Geographic: Select Geographic routing to direct users to specific endpoints (Azure, External, or Nested) based on where their DNS queries originate from geographically. With this routing method, it enables you to be in compliance with scenarios such as data sovereignty mandates, localization of content & user experience and measuring traffic from different regions.
  • Multivalue: Select MultiValue for Traffic Manager profiles that can only have IPv4/IPv6 addresses as endpoints. When a query is received for this profile, all healthy endpoints are returned.
  • Subnet: Select Subnet traffic-routing method to map sets of end-user IP address ranges to a specific endpoint. When a request is received, the endpoint returned will be the one mapped for that request’s source IP address. 

All Traffic Manager profiles have health monitoring and automatic failover of endpoints. Within a Traffic Manager profile, you can only configure one traffic routing method at a time. You can select a different traffic routing method for your profile at any time. Your changes will be applied within a minute without any downtime. 

Here we will test a demo on priority basis. 

First create two web app in two different region.


In the same way you can create another web app (dotnetguru02) in different region. below is both web app. one is in East US and another is in central US.

Create a traffic manager profile with below information. 


Now my traffic manager profile is ready.


Now create endpoint inside traffic manager.


First we need to add primary end point. then we will create failover end point.

Now my both endpoints are ready. 


Now go to traffic manager profile > Overview : copy the DNS name and paste it in browser url. 
you will see the priority1 web app. now disable the priority1 web app and again refresh the browser. you will see the priority 2 web app. 




Continue Reading →