Friday, September 23, 2022

What's the difference among app.use, app.run, app.map in Owin? When to use what?

 When dealing with a request we use IApplicationBuilder. And we have four methods available to interact with a request:

  • Use
  • Run
  • Map
  • MapWhen

These are called Request Delegates.

Use:

Adds a middleware to the application pipeline and it can either pass the request to next delegate or it can end the request (short- circuit request pipeline). It is the most commonly used method to interact with middleware. 

More simple (app.use inserts a middleware into the pipeline which requires you to call the next middleware by calling next.Invoke()).

 Run:

app.run inserts a middleware without a next, so it just runs.


Map: 

With app.map you can map paths, which get evaluated at runtime, per request, to run certain middleware only if the request path matches the pattern you mapped.


MapWhen:

Behaves almost the same as Map except that we can specify the detailed condition by using a HttpContext object. We could check for URL, headers, query strings, cookies, etc).


Thank you 

Monday, September 19, 2022

AZ-305 Exam question and answer

 Azure Monitor includes several different tools. Three of the options below are tools that are included in Azure Monitor. Which ones are they?

Ans:- VM Insights

Smart Alerts

Resource Mapper

Container Insights

Log Analytics

 

___________ is a part of Azure Monitor that monitors the availability, performance, and usage of web applications in the cloud and on-prem.

Ans :- Application Insights

Container Insights

VM Insights

Log Analytics

In Azure Monitor, ____________ allow you to perform data analysis and to create visual reports right in the Azure portal.

Dashboards

Power BI

Ans:- Workbooks

Playbooks

_________________ is a set of tools that provides support when issues with Azure services crop up and affect your environment. It consists of three different services, including Azure Status, Service Health, and Resource Health.

Azure Monitor

Azure Service Monitor

Ans:- Azure Service Health

Application Insights

 

____________________ is used to collect and view security analytics data and threat intelligence data in your environment. It uses Microsoft’s analytics and threat intelligence to detect previously undetected threats, and can be used to investigate incidents, using artificial intelligence.

Azure Security Center

Ans:- Azure Sentinel

Azure Monitor

Azure Attack Simulator

 

Which tool would you use to allow Steve to manage only the resources in the Finance resource group, while allowing Jen to manage only the resources in the Marketing resource group?

Resource Locks

Resource Tags

Ans:- Azure RBAC

Azure AD RBAC

 

RBAC roles can be assigned to ______________, __________________, _________________, and _______________.

Users, Resources, Groups, Managed Identities

Users, Resource Groups, Management Groups, Service Principals

Users, Groups, Distribution Lists, Managed Accounts

Ans:- Users, Groups, Service Principals, Managed Identities

 

A _____________ is a collection of permissions that defines the actions that can be performed by the entity to which it is assigned.

Ans:-Role Definition

Security Principal

Role Group

Managed Identity

 

Steve is a member of the Marketing group. The Marketing group is a member of the Sales group, which has been granted the Contributor role at the subscription scope. Steve will inherit the permissions defined in the Contributor role that is assigned to the Sales group.

Ans:- True

False

 

The Blue Widget Corp is deploying Azure AD. They will require dynamic groups, self-service group management, and self-service password reset for on-prem users. Which edition of Azure AD should they deploy in order to get these features, while minimizing costs?

Azure AD Free

Azure AD Basic

Ans:-Azure AD Premium P1

Azure AD Premium P2

 

You've been asked to check on how many users have administrative access in your Azure AD environment. Which identity governance tool should you use to accomplish this?

Entitlement Management

Ans :- Azure AD Access Reviews

Privileged Identity Management

Activity and Auditing

 

The Blue Widget Corp is a brand-new startup in the planning stages. They want to deploy a cloud-based version of Active Directory that supports group policy, Kerberos, and NTLM. Which Active Directory solution should you recommend?

Azure Active Directory Free

Azure Active Directory Premium P1

Azure Active Directory Premium P2

Ans:- Azure Active Directory Domain Services

 

Azure AD Identity Protection default policies that administrators can choose to enable. Select the default policies below.

There are multiple correct answers.

Ans:- MFA Registration Policy

User Lockout Policy

Ans:- User Risk Remediation Policy

User Expiry Remediation Policy

Ans:- Sign-In Risk Remediation Policy

 

___________________ is an Azure AD service that allows you to manage, control, and monitor access to resources in Azure AD, Azure, and other Microsoft Online Services such as Microsoft 365 or Microsoft Intune.

Azure AD Access Reviews

Ans :- Privileged Identity Management

Azure Identity Protection

Azure Security Center

 

You've been asked to enable just-in-time privileged access to Azure AD and Azure resources within the Blue Widget Corp subscription. Which tool or service would you use to accomplish this?

Azure Security Center

Resource Locks

Ans:- Privileged Identity Management

Identity and Access Management

 

To use Privileged Identity Management, you must first have an ________________ license.

Azure AD Free

Azure AD Premium P1

Ans:- Azure AD Premium P2

All Answers Are Correct

 

The four levels of management, in order of precedence, that are available in Azure include _____________, ______________, __________________, and _________________.

Ans:- management groups, subscriptions, resource groups, resources

subscriptions, tenants, resource groups, resources

management groups, tenants, subscriptions, resource groups

tenants, management groups, subscriptions, resource groups

 

______________ can be used to manage access, policy, and compliance for multiple subscriptions.

Tenants

Subscription Groups

Ans:- Management Groups

None of the Above

 

The organization that you work for is an MSP that supports several dozen customers. You've been asked to streamline the management of your customers' resources via Azure delegated resource management. Which solution should you recommend to make this happen?

Azure Sentinel

Ans:- Azure Lighthouse

Azure Monitor

Azure Management Group

 

When you create an Azure policy, you start with the _________________, which defines the conditions under which the policy will be enforced. Several policy definitions can be grouped together to form ______________. Once a policy definition or initiative has been created, __________________ is used to assign the policy definition or initiative to a scope of resources that Azure supports.

policy initiative, a policy definition, an assignment

policy definition, a policy initiative, a scope policy

Ans:- policy definition, a policy initiative, an assignment

policy, a policy assignment, a scope

_______________ focus on resource properties during deployment and for already existing resources to ensure those resources adhere to requirements and standards that you define; whereas _________________ are used to build entire environments that adhere to requirements and standards.

ARM Templates, Azure Policies

Ans:-Azure Policies, Azure Blueprints

Azure Blueprints, ARM Templates

Azure Blueprints. Azure Policies

 

There are two service tiers available in Azure Key Vault. The ____________ tier encrypts with a software key, while the _____________ tier includes HSM-protected keys.

Ans:- Standard, Premium

Basic, Premium

Free, Standard

Free, Premium

 

When using key vault to store keys and secrets, you can monitor their access and use by enabling logging for the vault. When doing so, you can configure Azure Key Vault to archive to a storage account, or to stream to an event hub. You cannot send the logs to Azure Monitor logs.

True

Ans:-False

 

The vCore-based purchasing model is available for both the Azure SQL Database offering and the Azure SQL Managed Instance offering.

Ans:- True

False

 

The Database transaction unit (DTU)-based purchasing model is available for both the Azure SQL Database offering and the Azure SQL Managed Instance offering.

True

Ans:- False

 

The Database transaction unit (DTU)-based purchasing model is available for both the Azure SQL Database offering and the Azure SQL Managed Instance offering.

True

Ans:- False

 

You've been asked by the Blue Widget Corp to deploy an Azure SQL Managed Instance. This instance will support a customer-facing app that can get quite busy. Availability is of utmost importance. Which purchasing model and service tier should you deploy?

DTU-Based Purchasing Model and Business Critical Tier

DTU-Based Purchasing Model and Hyperscale

Ans:- vCore Purchasing Model and Business Critical Tier

vCore Purchasing Model and Hyperscale

 

Azure disk encryption is used to protect both Windows and Linux virtual machines. It uses _______________ technology on Windows VMs, and _____________ on Linux VMs to protect ________________ with full volume encryption.

Microsoft InTune, Let's Encrypt, the OS disk only

Ans:- Windows BitLocker, Linux DM-Crypt, both the OS disk and data disks

Windows BitLocker, Linux DM-Crypt, the OS disk only

Windows BitLocker, Linux DM-Crypt, data disks only

 

Transparent Data Encryption, or TDE, can be used to encrypt __________________ data files in real time.

SQL Server

Azure SQL Database

Azure Synapse Analytics

Ans:- All

None

The Blue Widget Corp employs 50 people who are geographically dispersed. These users all work from home. You've been asked to deploy a solution that allows them to connect to the corporate network in New York. Which solution should you deploy to ensure these users can connect, and that their connections are encrypted?

Ans:- Point-to-Site VPNs

Site-to-Site VPNs

ExpressRoute Connections

Local Network Gateways

 

The Single Server deployment option of Azure Database for MySQL comes in three pricing tiers: _________________, ___________________, and _________________.

Ans:- Basic, General Purpose, and Memory Optimized

Free, Basic, General Purpose

General Purpose, Advanced, Memory Optimized

Free, Basic, Standard

 

Azure Database for PostgreSQL is a _______________ database service available in the Microsoft cloud. It’s available in three deployment modes, including ___________________, ______________, and ___________________.

relational, single server, flexible server, multi-server

non-relational, free, basic, premium

non-relational, single server, flexible server, hyperscale

Ans:- relational, single server, flexible server, hyperscale

 

Inventory management systems, order management systems, reporting databases, and accounting packages are common examples of solutions that leverage relational databases.

Ans:- True

False

The Blue Widget Corp has asked you to deploy a storage solution that will serve as the backend for an IoT system that's being deployed. This IoT system will consist of environmental sensors that collect data. Your storage solution will need to hold this sensor data. There needs to be a separate partition for each device, and the data that is collected and stored needs to be ordered by the date and time that each measurement was captured. Which storage solution would be a viable solution?

Azure File Storage

Ans:- Azure Table Storage

Azure Queue Storage

Azure Blob Storage

 

The Blue Widget Corp is deploying a new, static website to host assembly diagrams of its products. These diagrams are in image format (JPG, PNG, etc). Users will access these diagrams via their web browsers. Which storage solution should you deploy to allow the organization to serve up these images?

Azure File Storage

Azure Table Storage

Azure Queue Storage

Ans:- Azure Blob Storage




Thank you! All the best 

 

Thursday, September 8, 2022

Liskov Substitution Principle (LSP)

 In this article, we are going to discuss what is Liskov Substitution Principle (LSP) with real-world examples.

So your Object-Oriented Programming skills are at par and now you want to apply your knowledge to live projects.

After all, understanding the 4 basic pillars of Object-Oriented Programming and knowing a few cool things like constructor chaining and static methods should be enough to pull off the job right? Well, sorry to disappoint you but a S.O.L.I.D wall awaits!

solid principles

Knowing the basics is one thing but writing good quality code is another. This is where the 5 most important software design principles come into play! Out of those, the most important and the most misunderstood principle is the Liskov Substitution Principle (LSP). 

Well, guess what? The gods of Google have landed you on the right article because in this article we are going to talk all about LSP. So hop on as this will be the only article you’ll ever need for understanding the infamous LSP!

Liskov Substitution Principle (LSP)

Simply put, the Liskov Substitution Principle (LSP) states that objects of a superclass should be replaceable with objects of its subclasses without breaking the application. 

In other words, what we want is to have the objects of our subclasses behaving the same way as the objects of our superclass.

So the next time you create an object of the subclass by mistake, you should still be fine (given you implemented LSP).

But Mohit, what does this even mean? How can an object of another class behave the same way as another’s? You might ask. Let me give you a real-life example and it will be crystal clear to you.

Remember in 5th grade when your maths teacher taught you the formula of squares for rectangles and squares? I always remembered square as the more “formula-friendly” rectangle. It is after all a rectangle with equal sides, isn’t it? 

Now suppose you have a base class Rectangle and I tell you to create a new class Square and maximize reuse. Will you inherit the Rectangle class inside the Square class?

No matter how tempting it might sound or how well you intend to handle it, this small “reuse” will be totally WRONG!

Let us go by an example:

By looking at the above scenario you might still argue that it looks pretty consistent. That is true for the language you are coding in and also for Mathematics but a Square might not always satisfy the behavior of a Rectangle.

This is what I mean:

Your ClientMethod() expects a Rectangle and asserts a value of the area. All was well up to this point but now when we do rec.setHeight(4), our Square will set both its sides as 4, and that will totally mess up the assert statement.

We were expecting a Rectangle of sides 5 and 4 to have an area of 20 but we got a Square with sides 4 and 4 and area 16.

Hence, using Square’s object in place of the Rectangle’s object totally breaks LSP! Read the definition of LSP again:

Simply put, the Liskov Substitution Principle (LSP) states that objects of a superclass should be replaceable with objects of its subclasses without breaking the application.”

This was just a small example. There will be numerous other problems if you plan on creating an algebra application inheriting a Square from a Rectangle. 

Real-life Examples Which Break Liskov Substitution Principle (LSP)

  1. Your landlord wanted you to fix the main gate’s light bulb but you gave him Diwali vibes instead! (He won’t be happy!)
lsp example
  1. You fed your neighbor’s pet duck expired Bread and now it’s dead. You decided to replace it with a toy duck. (He won’t be happy!)
lsp example

Conclusion

The Liskov Substitution Principle is one of the five SOLID principles of object-oriented programming. All the five principles combined are helpful in making object-oriented code more readable, maintainable, and easier to upgrade and modify.

Thank you! Happy Learning.

Wednesday, September 7, 2022

Azure Load Balancer

 

Introduction to Azure Load Balancer

Microsoft Azure offers a load balancing service to distribute the load of inbound network traffics across different machines or virtual servers at the backend. A load balancer helps in maintaining high availability and makes hardware and software resilient to failures. Azure works as a transport layer in the Open Systems Interconnection (OSI) model. The load balancer does not direct the traffic to failed machines.

There are two types of configuration modes are used in Azure Load Balancer:

  • External – Public load balancing
  • Internal – Internal load balancing

Working of Azure Load Balancer

Microsoft Azure offers load balancing to the network in two modes so that inbound traffic flows based on the configured rules of load balancing. Load balancer helps in scale our application and create high available service here is the working of two modes in Azure load balancer:

1. Public (External) load balancer

A public Load balancer provides the outbound connection to the virtual machines (VMs) from the pool of backend virtual networks. For these outbound connections, all the private IP addresses are converted to the Public IP addresses so that each load balancer gets assigned with one Public IP address to accept the request coming from the internet. When load balancer gets called from the client apps then based on the load balancer configuration inbound traffic is distributed among Virtual Machines.

2. Private (Internal) load balancer

Private load balancers used if we need private IPs at the frontend. This load balancer uses a private IP address to call and all traffic is routed to the inside of the virtual network to the requested virtual machines. The internal load balancer uses source IP, source port, destination IP, destination port, and the protocol type to balance the internet traffic in virtual machines. It uses a hash function to distribute this load. If the source to destination IP connection is lost then the hash function forms a new connection with separate endpoints.

Below figure shows the Public and Private load balancer

How to Create an Azure Load Balancer?

1. Log in to the Azure Portal using the valid username and password:

2. Select Create a resource from the Home page of the portal.

Azure Load Balancer output 1

3. Now from the Search the Marketplace search for the Load Balancer in the search box:

Azure Load Balancer output 2

You will be redirected to the Load Balancer page as below:

Azure Load Balancer output 3

4. Select Create  button from the load balancer screen:

Azure Load Balancer output 4

5. User will be redirected to the below page which will ask for the configuration details:

Azure Load Balancer output 5

6. Enter the below information on the Create load balancer page:

Information is entered in the Basic tab:

Azure Load Balancer output 6

7. Now click on the Review + create button from the page:

output 7

The page will start the running validation about the configuration, If details is correct it will show validation passed message:

output 8

8. Now click on the Create button from the page and it will start deploying the resources.

output 9

9. Once the deployment is completed it will show the recently created load balancer:

output 10

10. Now select Go to resource from the page and select Backend pools from the right pane of the page:

output 11

11. User can add the backend pools detail her by selecting add button as per the requirement:

output 12

Features of Azure Load Balancer

Below are mentioned the features:

  1. Load Balancer: Azure load balancer provides users an option to configure the load balancer based on the role. Based on internal or external load balancer mode internet traffic is balanced on the Azure virtual machines.
  2. Availability Sets: Load balancer distributes resources of azure within and across virtual machines and zones.
  3. Port Forwarding: It provides features to port forward traffic to any particular virtual server by using public IP address and port.
  4. Application agnostic and transparent: This feature helps the user to direct the traffic based on URL or multi-site hosting as load balancer does not interact directly with TCP/IP or UDP also TCP and UDP flow on all the ports simultaneously with the help of HA(High Availability) ports.
  5. Automatic reconfiguration: The load balancer has the feature to reconfigure itself if we are scaling up or down the machines in the backend pool.
  6. Health probes: Load balancer has a feature to stop traffic flow to the failed machines which in turn helps to recognize failed virtual machines and this is done using a health probe. Users can configure a health probe to check on the health status of servers at the backend
  7. Outbound connection: Load balancer offers outbound connectivity to public or private IP addresses of azure virtual machines inside virtual networks.

Notes:- 

Microsoft Azure offers the data load balance service to maintain the high availability and scalability of the virtual machines and offers automatic reconfiguration of the system so that users have less effort in the maintenance of the azure with these services. Whatever users do on the internet we need to balance the load and it is done using these services. Here we have also learned how to create an azure load balance and configure the same based on roles.


Thank you! Happy Learning.