|
|
|
|
|
|
What is Azure API App, features and compare with Web App
|
|
With Azure API App, we can easily build, deploy and consume API on the cloud without managing underlying infrastructure. The key features of API Apps – authentication, CORS and API metadata. Features of Azure API App 1. Faster deployment of scalable Rest API’s 2. Support of Authentication with Azure AD and call Microsoft API’s 3. Consume APIs with CORS support 4. Swagger Support 5. Develop APIs with .NET, PHP, Node.js, Python or Java 6. Easily integrate with other Azure service like API management, Azure SQL, Logic apps and many more 7. Configure CI/CD to deploy your API’s 8. For Pricing refer to Azure App Service plan pricing. 9. Secure Platform that scales automatically 10. Monitor your App, configure alerts and do Auto scaling
Azure Web App vs API App1. Web Apps is a website which you can see in the browser whereas API is a service used in Web App. E.g: ASP.NET MVC application is Web App having UI with data where Web API return only data via end points for integrations to exchange data. 2. Now API APPs and Web Apps under the umbrella of APP Services if there is no difference, only icon difference in Azure Portal. 3. If you want to import API definition in Azure API management, you can do only with API App under App service.
Now, all of web, Mobile and API Apps are collectively coming under Azure App Services.
|
|
|
Why to use Azure App Service?
|
|
Azure App Service is a full managed Platform as a Service (PaaS) which enables to build and deploy web applications, Restful API’s, mobile back ends without managing underlying infrastructure with the choice of your programming language like .NET, .NET Core, Java, PHP, Python or Ruby. Application can run and scale on both windows and Linux environments.
Below are few features of Azure App service and based on this you can choose the service.
- Built-in Auto scale support – App service can be configured to scale up/down or scale in/out automatically based on your usage. Scale up/down increase the cores and RAM where as in/out increases or decreases the number of instances that are running your app.
- High Availability – Deploy your apps anywhere in Microsoft global data centers and with the right plan App service provides high availability for your application.
- IDE Integration – you can create, deploy and debug your azure app service application using visual studio, visual studio code, Java IDEs’ like Maven, Eclipse, IntelliJ.
- Continuous Integration and Deployment support – In the Azure portal, App service provides continuous integration and deployment with sources like Azure DevOps, GitHub, Bitbucket, FTP or local Git Repo from your local machine. Connect your application with the sources and App service will automatically synchronize your changes in the future.
- Deployment Slots – when you deploy your web app you can use separate deployment slot(staging) instead of production slot to test your changes with standard tier and above. Deployment slots have its own separate host names and you can swap content and configurations between deployment slots including the production slot. The swap operation warms up necessary worker processes to match your production scale with no downtime.
- Authentication – App service provides built-in authentication and authorization capability so your users can login to the App and access data based on the permissions with minimal changes to your code. You can use third party identity providers Microsoft, Facebook, Google, Twitter and GitHub.
- Multi language and Framework support – you can develop your application or APIs with .NET, PHP, Node.js, Python or Java of your choice even you can write power shell script to run back ground jobs. Easily manage your apps in App service by writing Power shell or Azure CLI scripts.
- Integrate with other services and SaaS Platforms – Easily integrate with other Azure service like API management, Azure SQL, Logic apps (SaaS connectors) and many more. You can access your on-premises data using Hybrid connection or Azure virtual network configuration with app service.
- API and Mobile scenarios - App service provided CORS support for Rest API’s and supports mobile apps scenarios like authentication, push notifications and offline data synchronization.
- Serverless Functions – you can use Azure App Service to run Azure functions with out managing underlying infrastructure. You will pay only for the compute time when your code is executed.
|
|
|
What is an Azure portal?
|
|
Azure Portal is a web application that provides an interface to manage your Azure resources. You can build, manage and monitor from simple to complex cloud deployments. Azure Portal has a presence across all Microsoft data centers and provides high availability and resilience in nature. Also, Azure Portal supports most well-known browsers and there is a mobile App for IOS and Android.
Let’s see few features • Create 200+ Azure resources from marketplace • Manage your subscriptions, costs and billing • Create dashboards to see focused view of your resources • In-built cloud shell to create or manage your azure service from browser • Monitor your services and workloads • Azure Active Directory – mange your user, groups and apps • Create support requests to reach out to Microsoft • Have your own portal settings like appearance, themes , language choice and configure notifications
|
|
|
What tiers does Azure API Management offer?
|
|
Azure API management comes in 2 different sets of tiers. - First one is consumption tier which is built per number of API executions and it is easier to start with even if your application is just picking the API traffic because Microsoft offers one million API executions for free every month. It does not incur any fixed costs.
- The other set of tires are the so-called dedicated tiers( called Developer, Basic, Standard, and Premium) where you are billed on an hourly basis, a fixed price and the offer more features than consumption tiers.
Note – You might incur additional charges for API management when using virtual networks, availability zone, and multi-region writes.
Azure API management is an azure service so your provisions in the azure cloud and route all the API calls through the azure cloud but Microsoft also offers self-hosted components like API gateway or the developer portal that you can host in other clouds like AWS, GCP or on-premises. References:
|
|
|
What are the different hosting plans for Azure functions
|
|
While creating Azure Functions, we must choose a hosting plan for the App. There are 3 basic plans named App Service Plan(dedicated), Consumption, and Premium plans and all these plans are available in Windows and Linux VM’s.
Let's look at what plan provides which features and based on these features and your needs you can select the right plan.
Feature/Plan | Consumption | Premium | Dedicated | Scaling | Automatically based on incoming requests | Automatically with pre-warmed instances so that no delays | Predictive scaling or Manual | Scale Out Max# instances | Windows - 200 Linux - 100
| Windows - 100 Linux - 20-100 | 10-20 | Cold start | With Idle scenario, scale goes to 0 and we have latency to scale | With Pre-warming feature there is no latency | NA - function app runs continuously | Default Plan | Yes | No | No | VNET connectivity | No | Yes | Yes | App timeout(Min) | 5 mins | 30 mins | 30 mins | App time out(Max) | 10 mins | unlimited | unlimited | Billing | Pay only for the time when App runs | Pay as per runs plus pre warms | Pay as per App Service Plan | When to consider | - Scale automatically
- Pay only when you run
| - App requires continuous run
- You need more CPU, memory and high GB seconds than consumption plan
- More execution time than consumption plan
- VNET connectivity
| - Want to re-use existing App Service Plan
- Predictive scaling and cost requirements
|
Other than these 3 basic plans, we have App Service Environment(ASE) and Kubernetes isolation plans, do refer Microsoft documentation.
|
|
|
As developer, why to consider .NET for Azure functions
|
|
As a Serverless solution, Azure Functions provides ready to code environment to developers with Visual studio and Visual Studio Code IDE's. With this, developers are able to focus on piece of code that is important to them. When you get started with .NET Programming for Azure functions, you do not need to setup server or maintain infrastructure by yourself, you get control over the App start up, configuration process and many of other features out of the box.
As a .NET developer with no change in habits, you can leave current .NET behaviors like dependency injection and incorporate middleware into your Function App. On top of that Azure Function app make your code available in the cloud with CI/CD with Azure DevOps and Github Actions. You can run your code with highly scalable on demand computer resources and easily integration with other azure services such as Azure storage, Eventgrid, CosmosDB and many more Azure Services.
|
|
|
What are the differences between Azure functions and Azure logic apps
|
|
Azure function and Azure logic apps both are serverless workloads. Let's look at a few differences below.
Azure Functions | Azure logic Apps | Execute event-driven serverless code functions with an end-to-end development experience | Automate the access and use of data across clouds | serverless compute services | Serverless workflows | Code first approached - imperative | Design first - declarative | Uses App Insights for monitoring | Uses Azure Monitor logs and Azure Portal | Managed with Rest API and Visual studio | Managed with Azure Portal, Rest API, Visual studio and PowerShell | Execute locally or in cloud | Run any where | Lot of binding types and extend your own bindings | Lot of connectors or build your own | We can call Azure logic apps from Functions | We can call Functions from logic app | Write code for each activity to execute | In built read made actions(app connectors) available to integrate from the collection |
Based on above comparisons and your requirement factors you can choose any of the service.
|
|
|
What are the common usages of Azure functions?
|
|
Azure Functions are great solution to build scalable systems and below are a few usage scenarios - To send emails or notifications
- Processing the file data - When the blob is added or updated you can run Azure functions
- Integration with the different systems
- Run batch processes on schedule time - Using Timer Trigger you can schedule jobs
- Database backups and cleanups - To administer your DB activities
- IoT data processing - using Azure Event Hub biding you can collect data from IOT devices
- Build APIs and microservices - Using the HTTP trigger endpoint you can build APIs
There are many more ways, based on your need you can evaluate other features of Azure functions and implement.
|
|
|
What is Azure Functions
|
|
Azure functions is a logical unit of code that lets you execute your code in a server less environment without worrying about application infrastructure. It provides updated infrastructure and your application runs at a scale automatically whenever there is a load.
You can develop your function code using C#, Java, JavaScript, Powershell, and Python languages of your choice. Package managers like Nuget and NPM are supported so you can use popular libraries in your application logic.
Azure functions are surrounded by triggers and bindings. A function is triggered by a specific type of event.
Once the functions are developed and deployed to azure, then you can pay per use pricing model. The plans will be App Service Plan, Consumption Plan, and Premium plans.
|
|
|
Who should be using Azure functions?
|
|
- Azure functions provide ready-to-code environments and easy-to-code programming models as a Serverless solution.
- It helps developers to focus on coding and delivering key value to your organization without the need to set up servers and maintain infrastructure by themselves.
- If you are a .NET developer, you want to get started on .NET programming while taking advantage of cloud-based highly scalable, on-demand resources needed to run your applications, Azure functions are a way to go.
- Azure functions focus on event-driven scenarios, and it simplified the integration with many Azure services like Event Grid, and cosmos DB and with a broader range of events and bindings which allows one to connect other azure services with ease declaration.
- Supports the latest version of. NET. Always azure functions team works with the latest .NET features from the preview mode.
Start building apps with Azure functions.
|
|
|
What are the features of Azure functions?
|
|
Below are the few features of Azure functions - Server-less - Focus more on building your apps faster to add business value without managing infrastructure.
- Language of your choice - You can develop your function code using C#, Java, JavaScript, Powershell and Python languages of your choice.
- Custom development - you can bring your own dependencies using Nuget and NPM to extend your application logic.
- Continuous Integration and Deployment - you can set up your function code with continuous integration and deployment using GitHub, Azure DevOps, bitbucket and other CI/CD processes.
- Built-in Security - Protect your functions with SSL Bindings, VNet integration and OAuth providers. Authenticate users with the OAuth standard from providers such as Active Directory, Facebook, Twitter, Google, and Microsoft Account.
- Scale on demand - Automatically scale out whenever there is a need by adding compute power and scale in when the code is stopped running.
- Optimized Pricing - Pay only when your app runs.
- Performance and Monitoring - Easily configure Azure App Insight to your App for monitoring and analyzing the app performance.
- Connect to Other Services - Use triggers and bindings that enable your server-less applications to respond to events and connect to other services seamlessly.
- Choice of hosting plan - Based on your need, you can opt for Consumption, Premium or App Service Plan.
|
|
|
Are Azure functions free?
|
|
Yes, Azure functions provide free grants(1 million requests and 4,00,000 GB-s of resource) which applies to paid, consumption subscriptions only per month.
Once the Azure functions are developed and deployed to azure, then you can pay per use pricing model. While creating azure function, you must choose a hosting plan for your app. There are 3 types of pricing plans. - Consumption Plan - is billed based on per-second resource consumption and executions.
- Dedicate(App Service) Plan - Runs like your web apps. If the app service plan is shared between your applications and functions there is no additional cost for functions run.
- Premium Plan - It contains Pre-warmed instances that are always readily available to respond immediately. Also, it contains VNET connectivity for security. In this plan, you pay for Pre-warmed instances and any additional instance which you use to scale your app in and out.
Consumption and Premium plan automatically scale out whenever there is a need by adding compute power and scale in when the code is stopped running. Also, both plans provide a monthly free grant of 1 million requests and 4,00,000 GB-s of resource consumption per month per subscription in pay-as-you-go pricing across all function apps in that subscription.
In the App Service plan, your app does not scale automatically. Also, you must enable Always on setting so that your function app runs correctly.
Note: A storage account is created by default with each Functions app. The storage account is not included in the free grant.
|
|
|
What is the difference between CLR and DLR in C#?
|
|
What is DLR?- DLR is a runtime environment that adds a set of services for dynamic languages to the CLR.
- DLR makes it easier to develop dynamic languages to run on .net framework and give them .net interoperability.
- DLR introduces dynamic objects in C#
- DLR helps you create libraries that support dynamic operations
- Examples of languages developed by using DLR is IronPython,IronRuby etc.
What is CLR?- As part of the Microsoft .NET Framework, the Common Language Runtime (CLR) is the programming (Virtual Machine component) that manages the execution of programs written in any language that uses the .NET Framework, for example C#, VB.Net, F# and so on.
- Programmers write code in any language, including VB.Net, C# and F# when they compile their programs into an intermediate form of code called CLI in a portable execution file (PE) that can be managed and used by the CLR and then the CLR converts it into machine code to be will executed by the processor.
- The information about the environment, programming language, its version and what class libraries will be used for this code are stored in the form of metadata with the compiler that tells the CLR how to handle this code.
- The CLR allows an instance of a class written in one language to call a method of the class written in another language.
|
|
|
What are the features of Azure functions?
|
|
Below are few features of Azure functions - Serverless - Focus more on building your apps faster to add business value without managing infrastructure.
- Language of your choice - Develop your function code using C#, Java, JavaScript, Powershell and Python languages of your choice
- Custom development - Bring your own dependencies using Nuget and NPM to extend your application logic.
- Continuous Integration and Deployment - Set up your function code with continuous integration and deployment using GitHub, Azure DevOps, bitbucket and other CI/CD processes.
- Built-in Security - Protect your functions with SSL Bindings, VNet integration and OAuth providers. You can authenticate users with the OAuth standard from providers such as Active Directory, Facebook, Twitter, Google, and Microsoft Account
- Scale on demand - Automatically scale out whenever there is a need by adding compute power and scale in when the code is stopped running
- Optimized Pricing - Pay only when your app runs.
- Performance and Monitoring - Easily configure Azure App Insight to your App for monitoring and analyzing the app performance
- Connect to Other Services - Use triggers and bindings that enable your serverless applications to respond to events and connect to other services seamlessly
- Choice of hosting plan - Based on your need, you can opt for Consumption, Premium or App Service Plan
|
|
|
How do I deploy a function app in Azure?
|
|
Once the Azure functions are developed and there are different ways you can deploy your app to Azure. The different deployment methods are - Tool based deployments - deployments are managed locally. Useful when you are doing local development and requires multiple ad-hoc deployments manually.
- Visual Studio Code publish
- Visual Studio publish
- Core tools deployments (using Zip deploy or docker container)
- App Service Deployment - deployments are managed from the Azure App Service under Deployment section. Useful when you want to deploy as part of source control commits or from a container registry.
- Deployment center - Continuous deployment using Azure Repos, GitHub, Bitbucket and Local Git or Manual deployment using One drive, Dropbox, External Git and FTP.
- Container deployments
- External Pipelines - deployment are managed by pipelines. Useful for Production scenarios where you want to do some additional validations as part CI/CD.
|
|
|
What is Azure Functions Premium plan?
|
|
Once the Azure functions are developed and deployed to azure, then you pay per use pricing model. Azure function has below hosting plans - Dedicated app service plan
- Consumption plan
- Premium plan (called as elastic premium plan)
Azure functions Premium plan is a higher plan compared to other 2 plans. It contains following features - VNET Integration- To add more security to your app, you can configure a VNET and add your function app. With this, your function app is secured with service endpoints. VNET integration is not available in other plans.
- Pre-warmed instances to avoid cold start - In consumption plan, if there are no execution/calls to your function app it scales in to Zero instances. Once it goes to zero instances, if we make any function call, it takes some time(called as cold start time) to respond to the first call (from zero to one). This latency can be avoided in Premium plan with pre-warmed instances.
- Unlimited execution duration - Consumption plan has a 10 minutes limit whereas Premium plan defaults to 30 minutes but you can modify it to unlimited(60 minutes guaranteed). Use functiontTimeout property in host.json file to change the configuration.
- Premium hardware - Provides best cores(1, 2 and 4), memory and storage.
- Multiple function apps can be deployed to the same plan and all function apps in premium plan shares pre-warmed active instances.
- Automatic Scaling - Like consumption plan, your app will scale in or scale out based on the need.
Note: Premium plan is charged based on the number of core seconds, memory used and configured pre-warmed instances.
|
|
|
What is Azure Functions Runtime?
|
|
Azure Function Runtime is a specific version runtime where your Function App runs on top of it. Currently Azure function supports 3 versions of runtime host - 1.x - Supports .NET Framework
- 2.x - Supports .NET Core2.1
- 3.x - supports .NET Core3.1
All 3 versions are supported for your production workloads. By default, Function Apps are created in 3.x version runtime. If you are using C# language to develop Azure functions and visual studio gives below options as function runtime while creating Function App - Azure Functions V3(.NET Core)
- Azure Functions V2(.NET Core)
- Azure Functions V1(.NET Framework)
In order to find the function version number in your project, refer .csproj file. 1.x version setting in .csproj file<TargetFramework>net461</TargetFramework> <AzureFunctionsVersion>v1</AzureFunctionsVersion>
2.x version setting in .csproj file<TargetFramework>netcoreapp2.1</TargetFramework> <AzureFunctionsVersion>v2</AzureFunctionsVersion>
3.x version setting in .csproj file<TargetFramework>netcoreapp2.1</TargetFramework> <AzureFunctionsVersion>v2</AzureFunctionsVersion>
We are just referring C# as language, for other languages refer Azure Functions documentation.
|
|
|
What is Azure functions template
|
|
While creating Azure Functions with Visual Studio and visual studio code, IDE provides different project templates which are used to create function triggers which can be deployed to Azure Function App. Below are the different function templates available in Visual Studio - Blob Trigger - Creates a function trigger when a blob is added to a container
- Cosmos DB Trigger - Creates a function trigger when a document change in document collection
- Event Grid Trigger - Creates a function trigger when an event grid receives a new event
- Event Hub Trigger - Creates a function trigger when an event hub receive a new event
- HTTP Trigger - Creates function triggered by HTTP Request
- IoT Hub Trigger - Creates a function trigger when an IoT hub receives a new event on the event hub endpoint
- Queue Trigger - Creates a function trigger when a message is added to specified azure storage
- Service Bus Queue Trigger - Creates a function trigger when a message is added to specified service bus queue
- Service Bus Topic Trigger - Creates a function trigger when a message is added to specified service bus topic
- Timer Trigger - Creates a function trigger on a specified schedule
|
|
|
|
What is difference between SPContext.Current.Web and SPContext.Current.Site.OpenWeb()
|
|
To refer SPWeb object sometimes we use SPContext.Current.Web or SPContext.Current.Site.OpenWeb(). Here we will see What are differences between SPContext.Current.Web and SPContext.Current.Site.OpenWeb() SPContext.Current.Site.OpenWeb()- Creates a new instance of the SPWeb object, and we are responsible to dispose after using it.
- OpenWeb() with out sending parameters opens root web of current site collection. If OpenWeb() with parameters opens specific web site.
- Expensive call - It cost more resources than reusing an existing one.
SPContext.Current.Web :- Gives you access to the current instance of SPWeb, and you must not dispose it
- Gives current Subsite if you are at web other than root web.
|
|
|
|
|
|
|
|
|
|