Site icon Rajeev Singh | Coder, Blogger, YouTuber

App modernization using Native Cloud Development

Migrating your on-premises workload to the cloud using the Cloud Native development scenario offers numerous advantages, such as increased scalability, flexibility, and cost savings. By following the step-by-step process outlined in this document, you can ensure a smooth and successful migration.

This post demonstrates how we can get started with Application modernization using Cloud Native Development approach.

This post is the continuation of the previous article on App Modernization scenario where we covered App re-host, and containerization in detail.

Overview:

Let’s look at the picture that talks about the Journey to the Cloud.

Monolithic apps that provide strategic enterprise functions might best benefit from a Cloud-Native approach.

The right migration strategy depends on organizational priorities and the systems you’re targeting. For many, it may be more cost-effective to cloud-optimize a monolithic application or add coarse-grained services to an N-Tier app. In these cases, you can still make full use of cloud PaaS capabilities like the ones offered by Azure App Service.

Cloud Native development:

The Cloud-Native modernization maturity level usually requires new development investments. Moving to the Cloud-Native level typically is driven by the business need to modernize applications as much as possible to drastically improve scale in large applications by creating autonomous subsystems (microservices) that can be deployed and scale independently from other areas of the application while lowering costs in the long term and increase evolution agility of those autonomous app’s parts that provide significant compete advantages.

The main pillars of Cloud-Native applications are based on microservices architecture approaches, which can evolve with agility and scale to limits that would be difficult to achieve in a monolithic architecture, deployed to either on-premises or cloud environment.

Below picture shows the main characteristics of the Cloud-Native model.

Cloud-Native is a more advanced or mature state for large and mission-critical applications. Cloud-native applications usually require architecture and design that are created from scratch instead of modernizing existing applications.

Cloud-optimized apps can be Microservices based or monolithic web apps or N-Tier apps.

The Twelve-Factor App (a collection of patterns that are closely related to microservices approaches) is also considered a requirement for cloud-native application architectures.

The Cloud Native Computing Foundation (CNCF) is a primary promoter of cloud-native principles.

Business drivers

Let’s take an example for a customer who is experiencing tremendous growth and has determined that their applications need a major redesign to meet the anticipated growth and future business demands.

Below are the business drivers for this Digital Transformation:

Migration goals

Let’s assume the Customer has below system for Digital Transformation and needs Cloud Native development:

Web:

Leverage Microsoft Azure HA and Scalability features to support the following:

Mobile member:

IoT:

CRM Integration:

Additionally, below are NFR:

NFR TypeDetails  
Performance To leverage tools/out-of-box functionalities (Azure Load testing, Visual Studio Load Testing) to do performance testing to get the Response Time, throughput, Utilization, and Static volume.
MonitoringEnable the Application insights to get the trace details, Page View to monitor the application.
SecurityFor authentication, design the security using Cloud Identify/Azure AD
ScalabilityApplication should be scaling up / scale down based on the load and compute resources (CPU, memory, and network)
Configuration ManagementTo leverage the PaaS services in the cloud to store the configuration data
AvailabilityTo leverage Azure PaaS HA feature for high availability
Logging/AuditAzure Audit Logs will be used to store information on the operations of Azure resources. Web and IoT will be using Azure storage, e.g., Azure Table/Blob for storing the log information.

Solution design

It’s time to design the solution, let’s look at the current architecture and propose a new one.

Current architecture

Understand the current system, review the current system, Functional requirements, System components, Integration point, and Database details.

Also, understand the Non-Functional requirements, such as Performance, Monitoring, Security, Scalability, Configuration management, and Availability.

Let’s assume that below are the Current System details.

Assessment:

App and Data Modernization

Cloud Adoption Security Review

Proposed architecture

The proposed solution for the current client should be focused on focused on implementing identified set of patterns as the First objective; functional aspects of the system covering the key functionalities is another objective of this solution.

Among all the nonfunctional requirements security is one of the key aspects and is expected to be implemented in the following aspects –

Enforce authorization for more fine-grained access to microservices.

Based on Customer requirements below are the key solutions available, and the solution needs to be selected based on technology, and customer IT roadmap.

Based on the above details, let’s assume that the Customer decided on technologies.

Create a logical view of these components.

Logical View:

Create a Logic View of the proposed architecture, it includes below components:

LayerMulti-pattern: Request/Response, Fire& Forget, Callback, Streaming Multi-protocol: Json, OAuth2.0
Presentation Layer/Channels  Web Mobile IoT CRM E-commerce etc.
Request/Response patterns/Protocols  API Orchestration, Exception & Logging, Authentication, Authorization, Monitoring DevOps, Security, etc.
APIM (Orchestration layer)  Web API, API Framework, Utility Services, Caching, Throttling
Integration Layer  APIM, Authentication, Documentation, Development Portal
Database/Back endDatabase, CRM DB, Storage, File
Governance LayerAPI Orchestration, Exception & Logging, Authentication, Authorization, Monitoring DevOps, Security etc.

Solution Architecture:

Below are a few recommended articles for designing the web app for our case.

Web architecture design – Azure Architecture Center | Microsoft Learn

Let’s have a look at the proposed Solution Architecture.

Serverless web application – Azure Architecture Center | Microsoft Learn

Solution Components:

Solutions will be developed utilizing cloud-native components using Azure, and the solution will leverage Multi-Regional high availability sets for increased availability & scalability.

The solution has below components:

Web Layer

The web layer hosted as part of Azure Web Apps instance has Angular JS, CSS3, and jQuery.

Static image files pertaining to the solution will be hosted in Azure Storage, whereas the Azure CDN will work to distribute content according to the region from where a user connects to the application.

The JSON data structure exposed by API Orchestration layer will be utilized by Angular JS for direct consumption.

API Orchestration Layer:

API Orchestration Layer will be the key layer for the proposed solution, and it will consume CRM API/restful services and any API exposed by IoT. After consuming the response from CRM API, it will apply its own business logic and will expose RestFul Services to Web and Mobile App.

Azure Storage/Blob will be holding relevant log information to support monitoring and telemetry data for all these integration points (like request-response time for CRM, IoT interaction, etc..)

Azure Redis Cache will be holding frequently referred to entities facilitates to refer it by all the hosted APIs.

Storage/DB:

Azure Storage like Table/Blob will be used for logging errors and for monitoring. The solution will also use Cosmos DB for device registration/activity. CRM used in the solution is Microsoft SaaS offering and acts as a backend DB.

Note: IoT and Mobile related solutions are out of the scope of this post. We will cover this in detail in another post.

Design Patterns/Solution Components Description:

PatternsSolutionMicrosoft Azure  
Pipes and Filters PatternDecompose a task that performs complex processing into a series of discrete elements that can be reused to improve performance, scalability, and reusability.Azure Functions
Cache-Aside PatternAzure Functions, Redis Cache, and Azure SQLAzure Redis Cache
Command & Query Responsibility Segregation (CQRS)Segregate operations that read data from operations that update data by using separate interfaces. This pattern can maximize performance, scalability, and security.Delegate authentication to an external identity provider. This pattern can simplify development, and minimize the requirement for user administration.  
Federated Identity PatternDelegate authentication to an external identity provider. This pattern can simplify development, minimize the requirement for user administration.  Azure Active Directory
Gatekeeper PatternProtect applications and services by using a dedicated host instance that acts as a broker between clients and the application or service, validates and sanitizes requests, and passes requests and data between them.  API Management
External configuration store patternMove configuration information out of the application deployment package to a centralized location for easier management and control of configuration data.  Azure Key Vault
Static Content Hosting PatternDeploy static content to a cloud-based storage service that can deliver these directly to the client. This pattern can reduce the requirement for potentially expensive compute instances.Azure Blob Storage/CDN
Throttling PatternControl the consumption of resources used by an instance of an application, an individual tenant, or an entire service.API Management
Valet Key PatternUse a token or key that provides clients with restricted direct access to a specific resource or service to offload data transfer operations from the application code.API Management
Asynchronous Messaging PrimerMessaging is a key strategy employed in many distributed environments such as the cloud. It enables applications and services to communicate and cooperate and can help to build scalable and resilient solutions.Azure Storage Queues

Application Development

Reliable web app pattern

Reliable web app pattern – Azure Architecture Center | Microsoft Learn

The reliable web app pattern provides essential implementation guidance for web apps moving to the cloud. It defines how you should update (re-platform) your web app to be successful in the cloud. The reliable web app pattern focuses on minimal code changes, reliability design patterns, and managed services so you can rapidly adopt the cloud.

 12 factors

Use below 12 factors as guidelines to help steer the development of new applications, as well as to create a scorecard with which to measure existing applications and their suitability for the cloud:

  1. Codebase: One codebase tracked in revision control, many deploys
  2. Dependencies: Explicitly declare and isolate dependencies
  3. Configuration: Store configuration in the environment
  4. Backing Services: Treat backing services as attached resources
  5. Build, release, run: Strictly separate build and run stages.
  6. Processes: Execute the app as one or more stateless processes
  7. Port binding: Export services via port binding
  8. Concurrency: Scale out via the process model
  9. Disposability: Maximize robustness with fast startup and graceful shutdown
  10. Dev/prod parity: Keep development, staging, and production as similar as possible.
  11. Logs: Treat logs as event streams
  12. Admin processes: Run admin/management tasks as one-off processes.

Azure Well Architecture Framework

Use Azure Well Architecture Framework and define Reliability, Security, Cost Optimization, Operational excellence, and performance efficiency for each service used for the proposed solution.

Identity Services

SPA, Web Apps

Web API and APIM

Storage (Azure SQL, Cosmos db, Blob, etc.)

Security

The solution must consider security implementation in all layers across the components including API, Azure Functions, static storage, queues, messages, web forms/SPA & the back-end systems.

SSL with assymetric keys with 256 encryptions must be enforced across the layers & components and specific security measures across each interaction & component.

Below are the security design considerations followed for web app:

The Microsoft identity platform supports authentication for different kinds of modern application architectures. All of the architectures are based on the industry-standard protocols OAuth 2.0 and OpenID Connect.

By using the authentication libraries for the Microsoft identity platform, applications authenticate identities and acquire tokens to access protected APIs.

Scenarios and supported authentication flows

Scenario: Accessing API from WebApp (SPA)

As per the proposed solution, SPA needs to consume all the API for Business Logic, and thus all the API endpoints must be secured.

In our case, it is SPA, and in this scenario, the Application run on a web browser and has different authentication characteristics than traditional server-side web applications.

The Microsoft identity platform provides two options to enable single-page applications to sign in users and get tokens to access back-end services or web APIs.

You have below options:

Using the authorization code flow with PKCE is the more secure and recommended authorization approach, not only in native and browser-based JavaScript apps, but for every other type of OAuth client.

The OAuth 2.0 authorization code grant type, or auth code flow, enables a client application to obtain authorized access to protected resources like web APIs. The auth code flow requires a user agent that supports redirection from the authorization server (the Microsoft identity platform) back to your application. For example, a web browser, desktop, or mobile application operated by a user to sign into your app and access their data.

authorization code

Apps using the OAuth 2.0 authorization code flow acquire an access_token to include in requests to resources protected by the Microsoft identity platform (typically APIs). Apps can also request new ID and access tokens for previously authenticated entities by using a refresh mechanism.

Note:

ADAP has been deprecated, so use MSAL  Microsoft Authentication Library (MSAL).

The implicit grant flow is no longer recommended – use authorization code with PKCE instead.

Solution review

Plan to have Governance and CoE for your migration and review the solution and its implementation from time to time.

List out-of-scope items, Risks, and Blockers from time to time.

All the deliverables mentioned in the document will have the acceptance criteria of being signed off by the Client PM for proceeding to the next logical phase.

Migration methods

Plan your Project and have below details at high level.

Implementation:

It’s time now for implementation, start your project with all the above steps.

Deployment and Automation:

We explored Angular, APIM, Web API, and Backend DB for the solution.

The application is deployed in PaaS Service, below is one reference for automated deployment for this Solution.

DevTest and DevOps for PaaS solutions – Azure Solution Ideas | Microsoft Learn

Monitoring

Monitoring is the act of collecting and analyzing data to determine the performance, health, and availability of the business application and the resources that it depends on. An effective monitoring strategy helps understand the detailed operation of the components of the application. It also helps increase uptime by proactively notifying us of critical issues so that they can be resolved before they become problems.

Below are our key metrics for Monitoring.

Application Insights

We are using Azure Application Insights to monitor the availability, performance, and usage of the application, whether it’s hosted in the cloud.

Azure Monitor

Azure Monitor enables core monitoring for Azure services by allowing the collection of metrics, activity logs, and diagnostic logs. For example, the activity log tells us when new resources are created or modified.

Web application monitoring on Azure – Azure Architecture Center | Microsoft Learn

High Availability

Design for high availability for your solution.

Highly available multi-region web app – Azure Architecture Center | Microsoft Learn

Conclusion

In this article, we covered details on how we can plan to modernize legacy Web App with modern SPA and start your Cloud Native Development journey.

In an upcoming post, we will deep dive on below topics:

Stay tuned for further posts.

Details of upcoming blogs.

1. Designing Cloud Native SPA using Angular:

– We will discuss the key principles and concepts behind designing a cloud-native SPA using Angular. This will include understanding the benefits of a cloud-native approach, architecture patterns, and best practices.

2. Designing Web API and APIM:

– We will explore the process of designing Web APIs and how to leverage Azure API Management (APIM) to manage and secure these APIs effectively. This will include topics such as API design principles, authentication, authorization, and how to expose and consume APIs securely.

3. Designing Backend Data for the Solution:

– We will dive into the different options available in Azure for storing and managing data in the backend of our cloud-native SPA. This will include Azure SQL, Azure Storage, and Cosmos DB. We will discuss the pros and cons of each option and how to choose the right data storage solution based on specific requirements.

4. Security Guidelines:

– Security is a critical aspect of any application. We will provide comprehensive guidelines on how to design and implement secure features in our cloud-native SPA. This will include topics such as authentication, authorization, data encryption, and protecting against common security threats.

5. Deployment Best Practices and DevOps:

– We will explore the best practices for deploying our cloud-native SPA to Azure. This will include topics such as infrastructure as code (IaC), continuous integration and continuous deployment (CI/CD) pipelines and leveraging Azure DevOps for automating the deployment process.

6. Monitoring Best Practices and Tools Setup:

– Monitoring is essential for maintaining the health and performance of our cloud-native SPA. We will discuss the best practices for setting up monitoring and alerting in Azure. This will include topics such as Azure Monitor, Application Insights, and other relevant tools for monitoring and troubleshooting.

Stay tuned for our upcoming posts, where we will provide in-depth insights into these topics. We are excited to share our knowledge and help you design robust and scalable cloud-native SPAs using Angular.

References:

Introduction to cloud-native applications – .NET | Microsoft Learn

What about Cloud-Native applications? – .NET | Microsoft Learn

Introduction to cloud-native applications – .NET | Microsoft Learn

The Twelve-Factor App (12factor.net)

What is Cloud Native? | VMware Tanzu

Microsoft identity platform overview – Microsoft Entra | Microsoft Learn

JavaScript single-page app scenario – Microsoft Entra | Microsoft Learn

Microsoft identity platform app types and authentication flows – Microsoft Entra | Microsoft Learn

Microsoft identity platform and OAuth 2.0 authorization code flow – Microsoft Entra | Microsoft Learn

DevTest and DevOps for PaaS solutions – Azure Solution Ideas | Microsoft Learn

Web application monitoring on Azure – Azure Architecture Center | Microsoft Learn

Highly available multi-region web app – Azure Architecture Center | Microsoft Learn

Exit mobile version