Application Insights with Azure App Service

Application Insights is a simple way to detect and diagnose exceptions and application performance issues in your web apps and web services. In this post, I will walk you through adding it to an ASP.NET MVC application. In order to take advantage of this, you’ll need to log into your Azure account and go to your App Service that you created and look under Monitoring then you will see Application Insights. Open it and create a new resource and press OK as shown below.  You’ll see that you can automatically instrument your ASP.NET app with a restart. Once completed, go and visit your app and refresh a couple of times and then go back and take a look at the live stream. 

If you add Application Insights to your Visual Studio project by right-clicking the project and then adding Configure Application Insights, then you can add code to collect exception telemetry. 

Keyboard Shortcuts in the Azure

Keyboard shortcuts in Azure

It happens a lot that developers are asking for keyboard shortcuts in any environments. Azure has the following keyboard shortcuts:

ACTIONS

CTRL+/ Search blade menu items
G+/ Search resources (global)
G+N Create a new resource
G+B Open the ‘More services’ pane

NAVIGATION

G+, Move focus to command bar
G+. Toggle focus between top bar and side bar

GO TO

G+D Go to dashboard
G+A Go to all resources
G+R Go to resource groups
G+number Open the item pinned to the favorites bar at this position

Load Test with the Azure

Check your web app’s performance before you launch it or deploy updates to production. That way, you can better assess whether your app is ready for release. Feel more confident that your app can handle the traffic during peak use or at your next marketing push. You’ll need a Visual Studio Team Services (VSTS) account to keep your performance test history. A suitable account will be created automatically when you set up your performance test. Or you can create a new account or use an existing account if you’re the account owner. Deploy your app for testing in a non-production environment. Have your app use an App Service plan other than the plan used in production. That way, you don’t affect any existing customers or slow down your app in production.

Set up and run your performance test
1- Sign in to the Azure Portal. To use a VSTS account that you own, sign in as the account owner.

2- Go to your web app.

3- In the DEVELOPMENT TOOLS section choose Performance test.

4- Now you’ll link a VSTS account to keep your performance test history. Choose Set Account.

5- If you have a VSTS account to use, select that account. If you don’t, create a new account.

6- Choose + New to create a new performance test.

7- Set the details and run the test. Your web app’s default URL is added automatically. You can change the URL to test other pages (HTTP GET requests only). To simulate local conditions and reduce latency, select a location closest to your users for generating load.

You simulate load on your app by generating virtual users (customers) who visit your web site at the same time. This will show how many requests are failing or responding slowly.

 

Azure Leads the Industry in ISO Certifications

Microsoft Azure recently completed a new set of independent third-party ISO and Cloud Security Alliance (CSA) audits to expand the certification portfolio.  Azure leads the industry with the most comprehensive compliance coverage, enabling customers to meet a wide range of regulatory obligations.  If that were not enough, having a program with industry leading depth and coverage specific to ISO is exponentially useful to our customers globally as ISO standards provide baselines for information security management that are relied upon by many other standards across regulated industries and markets worldwide. A combination of our ISO and CSA certifications exist in all four Azure clouds, and coverage is now newly expanded across the following clouds

image

Achieving the ISO 20000-1:2011 certification specifically underscores Azure’s commitment to deliver quality IT service management to customers and demonstrates Azure’s capability to monitor, measure, and improve service management processes. The CSA STAR Certification involves a rigorous independent third-party assessment of a cloud provider’s security posture that combines ISO 27001 certification with criteria specified in the CSA Cloud Controls Matrix. Azure maintains the highest possible Gold Award for the maturity capability assessment of the CSA STAR Certification, and as previously stated, is now available in the Azure Government cloud. In addition to the broadest compliance portfolio amongst enterprise cloud providers, Azure maintains the deepest coverage as measured by how many customer-facing services are in audit scope. For example, recently completed Azure ISO 27001 and ISO 27018 audits have 61 customer-facing services in audit scope, making it possible for customers to build realistic ISO-compliant cloud applications with end-to-end platform coverage.

Host a RESTful API with CORS in Azure App Service

This post explains the required steps to deploy an ASP.NET Core API app to App Service with CORS support. You can configure the app using command-line tools and deploy the app using Git.

Azure App Service provides a highly scalable, self-patching web hosting service. In addition, App Service has built-in support for Cross-Origin Resource Sharing (CORS) for RESTful APIs. 

The required steps:

 

Install Git.
Install .NET Core.
Create local ASP.NET Core app

API apps in Azure App Service offer features that make it easier to develop, host, and consume APIs in the cloud and on-premises. With API apps you get enterprise grade security, simple access control, hybrid connectivity, automatic SDK generation, and seamless integration with Logic Apps. In simple words, it is a platform to host the Web apps with the most common API features for which you don’t have to code.

We can directly host the Application in a Web app and leverage all the Services given above:

Inbuilt Swagger Integration.
Ability to push your API APPS into Azure MarketPlace.
API definition.
Support for creating an Azure API client from Visual Studio.
We are going to create a demo and discuss all the 4 main reasons along with the demo.

Create an API from Visual Studio and host it in Azure API app

Go to Visual Studio -> Visual C# -> Web -> ASP.NET Web Application, enter the name of the API and click OK button. Now, select Azure API app from the dialog box. We can select Web API as well and then publish it as Azure API app, which will also serve the same purpose.

Inbuilt Swagger Integration

  • As we have selected an Azure API app, some of the common Web API used packages like Newtonsoft.Json and Swasbuckle.core (Swagger) come directly in the template.
  • Create an API Controller by right clicking on the Controller and Add -> Controller.
  • Now, select the Web API 2 Empty Controller. You can use any of the controllers but for this post, we are going to use the empty controller.
  • Name the controller as Calculator Controller and as we selected the WEB API 2 template, its going to be derived from the APIController. 
  • Now, we need to publish the API to Azure API app instance. Right click on the project and click Publish.
  • Select Azure API app and enter your credentials to authenticate and login. 
  • Enter the name and select a Resource Group, AppService plan in the approproiate subscription. If you don’t have the Resource Group or an app Service plan, you can create from the same wizard by clicking the respective new button and pass the appropriate values. Once all the values are passed, click Create button. It’s going to create an Azure API Web app in your Azure account.
  • Once completed, the published metadata file will be downloaded and subsequently you can click Publish button to push your binaries.
  • Once the publish is complete, it’s going to open up the URL in your Browser.
  • Append the swagger to the URL and you can see all the Methods, which we have created in our code above.
  • Swagger UI also allows you to test the methods by acting as a Client. We are trying the Sub method and passed two params to it and clicked the “TRY IT NOW” button. Now, we will contact the API and return the result. This is very useful in case of APIs, as you can straightaway test your APIs and see if it’s working fine or not without writing a single line of code.
  • Now, go to Azure and go to your resource. Select the API definition and you can see that it gives you an option to export the metadata to the PowerApps and Microsoft Flow.
  • Now, add a new project and select a console Application.
  • Right click on the project and add REST API client.
  • Now, add the metadata URL or select an Azure asset, which we have created and click OK button to download the metadata associated with it. Now, consume the Service, as we do in any other client with the supported metadata.

Copyright © All Rights Reserved - C# Learners