Sunday, January 13, 2019

Microsoft Azure Interview Questions





Azure active directory
There are two types of environments you can create. Deciding which you need is based solely on the types of users your app will authenticate.
  • Work and school (Azure AD accounts) or Microsoft accounts (such as outlook.com and live.com)
  • Social and local accounts (Azure AD B2C)

Google app client ID and secret check this link to create.




3.     On deployment, what are the options are available in Azure and what are the different between them?

 Cloud service, App Service, VM Role, and Service Fabric.

·       Web Apps: Easy to deploy and manage, but no control on VM. It is very cheap.

·       Cloud service:  Some Control on VM but need some configuration in development. Compare to web app it is costly.

·       VM Role: Complete control on the VM and IIS. Need to take care of security risk and windows updates by developer and it is cost more.

·       Service Fabric: Micro services deployment and development.



4.     What are the Service Model in Cloud Computing?

PaaS, IaaS and SaaS



5.     For deployment which is batter between Cloud service and Web Apps, what are the difference between both?

Cloud service:  When need more control on sever like remote login, need to installed software in it and need to change or update configuration.

Web Apps: Easy to deploy and manage, but don’t have control on VMs.

6.     In which situation you would use PaaS and in which will use IaaS?

When it comes to IaaS, using an existing infrastructure on a pay-per-use scheme seems to be an obvious choice for companies saving on the cost of investing to acquire, manage and maintain an IT infrastructure. There are also instances where organizations turn to PaaS for the same reasons while also seeking to increase the speed of development on a ready-to-use platform to deploy applications.



7.     What is Azure fabric?

The Azure Fabric Controller functions as the kernel of the Azure operating system. It provisions, stores, delivers, monitors and commands the virtual machines (VMs) and physical servers that make up Azure.



8.     What is service fabric?

Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices. Service Fabric also addresses the significant challenges in developing and managing cloud applications. Developers and administrators can avoid complex infrastructure problems and focus on implementing mission-critical, demanding workloads that are scalable, reliable, and manageable. Service Fabric represents the next-generation middleware platform for building and managing these enterprise-class, tier-1, cloud-scale applications.






9.     What are the advantages of using micro services?

a)     Easy to deploy

b)     Ability to use a different technology stack

c)     System resilience











10.  Is service fabric batter then Cloud service, and why?

Service Fabric itself is an application platform layer that runs on Windows or Linux, whereas Cloud Services is a system for deploying Azure-managed VMs with workloads attached. In Service Fabric, VMs are only deployed once to form a cluster that hosts the Service Fabric application platform




11.  Is service fabric is replacement of Cloud service?

No



12.  What are the component in Azure storage model?

Table, Queue, Blob and File.



13.  What is different between blob, queue, and table storage?

Blob: For storing Images, VHDs and Logging.

Table: For storing structured datasets.

Queue: For storing messages.



14.  How you implement security on blob?

Using shared access signature.







15.  Why are there two keys for blob storage?

To avoid downtime and security concern.



16.  Different between Azure table and Azure sql database?

Azure table stores structural but no relational data while SQL stores relational data.




 





17.  For handling logging in your application which .net inbuilt library you will be use?

Enterprise Library



18.  What is the service bus?

Cloud based messaging system for sending and receiving messages asynchronously.



19.  What are the components in service bus, and what is different between them?

Queues, Topics and Relays.



20.  What is the difference between storage queue and service bus queue?

Storage Queue: Order guarantee and delivery guarantee is less and each message size is limited to 64kb. Cost is less when compared with service bus queue.

Service Bus Queue: Order guarantee and delivery guarantee is more and each message size is limited to 256kb. Cost is more when compared with storage queue.



21.  How you will migrate an on premise database to Azure, and what are the challenges can be there?

Using SQL server Management studio and Using BACPAC and DACPAC also.

Migration tool also available to help in migrating DB to Azure.



22.  Explain relay?

Bi-directional communication between two secured environments. Easy to establish communication between on premises and cloud application where firewall is not allowing communication.





23.  Explain document DB in Azure?

Can store nonstructural data. We can store JSON and java script object directly so need to transform in .net object.



24.  Which is batter between Entity framework and ADO.NET and which scenario which will be batter?

EF sits on top of the ADO.NET, which tells us that it can’t be faster than ADO.NET. But remember the power of LINQ which EF provides the developers. It is really powerful when comes with EF. Since EF encapsulates ADO.NET at the background it used ADO.NET only, but the question comes why EF then?? Yes if we use EF and LINQ then the maintainability and code redundancy reduces as we do not have to write the big queries anymore like SP and all.



25.  Type of Entity framework?

Code First, Model First and DB First.



26.  What is Federation in SQL Azure?

SQL Azure federation provides tools that allow developers to scale out (by sharding) in SQL Azure. Here are some of the benefits of a sharded database: Taking advantage of greater resources within the cloud on demand. Allowing customers to have their own database, to share databases or to access many databases








27.  What is Text Analytics API?

The Text Analytics API is a suite of text analytics web services built with Azure Machine Learning. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and topic detection. No training data is needed to use this API: just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions.






·       Sentiment - Is text positive or negative?

·       Key phrases - What are people discussing in a single article?

·       Topics - What are people discussing across many articles?

·       Languages - What language is text written in?







28.  What are the data synchronize services in Azure?

SQL Data Sync is a cloud-based data synchronization service built on Microsoft Sync Framework technologies. It provides single direction as well as bi-directional data synchronization and data management capabilities allowing data to be easily shared across Windows Azure SQL Databases across multiple data centers or between on-premises SQL Server databases and Windows Azure SQL databases.

These are the different scenarios for data synchronization using SQL Data Sync:

•Cloud (Windows Azure SQL Database) to cloud (Windows Azure SQL Database) synchronization

•Enterprise (SQL Server on-premises) to cloud (Windows Azure SQL Database)

•Cloud (Windows Azure SQL Database) to Enterprise (SQL Server on-premises)

•Bi-directional (changes made either on SQL Server or Windows Azure SQL Database are automatically synchronized back and forth) or sync-to-hub or sync-from-hub synchronization



29.  Different between structure and class?

A structure is a value type so it is stored on the stack, but a class is a reference type and is stored on the heap. A structure doesn't support inheritance, and polymorphism, but a class supports both. By default, all the struct members are public but class members are by default private in nature.



30.  What is the difference between heap and stack?

Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM . Variables allocated on the stack are stored directly to the memory and access to this memory is very fast, and it's allocation is dealt with when the program is compiled.



31.  What is different between reference type and memory type?

Structs are initialized using the default constructor. See also the default keyword to initialize generic types without knowing whether they are simple data types or not. The object is stored on the heap, with each field having a bit of space, either the value for a value type, or the pointer for other types.



32.  What are client side scripts you have worked?



33.  What is internal interface?

While you can make the interface itself internal, the methods would still be part of the public API. What you can select to do is explicit interface implementation, so that the API defined by the interface is only visible via the interface, and not via the class.














1)     App Service:



Ø  Azure App Service is the best choice for most web apps.

Ø  Deployment and management are integrated into the platform, sites can scale quickly to handle high traffic loads, and the built-in load balancing and traffic manager provide high availability

Ø  You can move existing sites to Azure App Service easily with an online migration tool.



2)     Service Fabric:

Ø  Service Fabric is about deploying applications to existing VMs or machines running Service Fabric on Windows or Linux.

Ø  Service Fabric is a good choice if you’re creating a new app or re-writing an existing app to use a micro service architecture.

Ø  Apps, which run on a shared pool of machines, can start small and grow to massive scale with hundreds or thousands of machines as needed.

Ø  Stateful services make it easy to consistently and reliably store app state, and Service Fabric automatically manages service partitioning, scaling, and availability for you. Service Fabric also supports WebAPI with Open Web Interface for .NET (OWIN) and ASP.NET Core

3)     Cloud Service:

Ø  Cloud Services is about deploying applications as VMs.

Ø  The code you write is tightly coupled to a VM instance, such as a Web or Worker Role. To deploy a workload in Cloud Services is to deploy one or more VM instances that run the workload.

Ø  There is no separation of applications and VMs, and so there is no formal definition of an application.

Ø  An application can be thought of as a set of Web or Worker Role instances within a Cloud Services deployment or as an entire Cloud Services deployment.





Compared to App Service, Service Fabric also provides more control over, or direct access to, the underlying infrastructure. You can remote into your servers or configure server startup tasks. Cloud Services is similar to Service Fabric in degree of control versus ease of use, but it’s now a legacy service and Service Fabric is recommended for new development.



This diagram illustrates the level of control associated with all three of the Azure services we’ve been discussing:







Service Fabric vs cloud service vs web apps vs VM role:



Deploying an application or an application update to a Cloud Service, or creating a VM, takes several minutes at least; deploying an application to a web app takes seconds.



Scale up to larger machines without redeploy using App Service (Web apps) and Service Fabric.



Web server instances share content and configuration, which means you don't have to redeploy or reconfigure as you scale for App Service (Web apps) and Service Fabric.



Micro service applications are composed of small, independently versioned, and scalable customer-focused services that communicate with each other over standard protocols with well-defined interfaces.



Cloud Design Patterns:








OWIN & Katana:






SOLID principles:








Impersonation:






OWIN and Katana:









OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools



MVC vs ASP.NET web forms:




Problem 1:- View based solution for Action based requirement

Problem 2:- Side effects of bad architecture: - Tight coupling

Problem 3:- HTML is not the only response type

Problem 4:- Flexible Combination of view and data

Problem 5:- Making behind code a normal class for unit testing




OAuth:



OAuth is a protocol that allows end users to give access to third party applications to access their resources stored on a server.



OpenID vs OAuth:

       OAuth
Used for delegated authorization only -- meaning you are authorizing a third-party service access to use personal data, without giving out a password. Also OAuth "sessions" generally live longer than user sessions. Meaning that OAuth is designed to allow authorization
I.e. Flickr uses OAuth to allow third-party services to post and edit a person’s picture on their behalf, without them having to give out their flicker username and password.
        

   OpenID
Used to authenticate single sign-on identity. All OpenID is supposed to do is allow an OpenID provider to prove that you say you are. However many sites use identity authentication to provide authorization (however the two can be separated out)
I.e. One shows their passport at the airport to authenticate (or prove) the person's whose name is on the ticket they are using is them.

In this article I want to show the differences between OpenID and its younger cousin OAuth by providing for each a typical user scenario.
First the scenario for OpenID:
  • User wants to access his account on example.com
  • example.com (the “Relying Party” in OpenID lingo) asks the user for his OpenID
  • User enters his OpenID
  • example.com redirects the user to his OpenID provider
  • User authenticates himself to the OpenID provider
  • OpenID provider redirects the user back to example.com
  • example.com allows the user to access his account
And now the scenario for OAuth:
  • User is on example.com and wants to import his contacts from mycontacts.com
  • example.com (the “Consumer” in OAuth lingo) redirects the user to mycontacts.com (the “Service Provider”)
  • User authenticates himself to mycontacts.com (which can happen by using OpenID)
  • mycontacts.com asks the user whether he wants to authorize example.com to access his contacts
  • User makes his choice
  • mycontacts.com redirects the user back to example.com
  • example.com retrieves the contacts from mycontacts.com
  • example.com informs the user that the import was successful
From those scenarios we can see that OpenID is about authentication (i.e. I can identify myself with an url) whereas OAuth is about authorization (i.e. I can grant permission to access my data on some website to another website, without providing this website the authentication information for the original website).
I hope this helps to keep apart those two standards :)


Azure Functions:
Azure PS deployment script:

All scripts reference:


Cloud service:

Web app:

Deploying from ARM:
Creating templates:

Deployment slots:
Staging publish webapp:
Create and deploy custom template from ARM portal:
PS deploy ARM templates:
Stack overflow: All ARM related articles.


CI with VS:






Azure PS scripts for ARM: Script Center






Stateful vs Stateless:





Stateless means the state of the service don't persist between subsequent requests and response. Whereas, in Stateful the state is persisted between subsequent requests i.e. each request need to know and retain changes made in previous requests.



Banking application is an example of Stateful application, where user first login then make transaction and logs out. If user tries to make the transaction after logout, he will not be able to do so.



Yes, http protocol is essentially a stateless protocol but to make it stateful we make use of HTTP cookies. So, is SOAP by default. But it can be make stateful likewise, depends upon framework you are using.





Async & Await VS Multi-Threading:

You are cooking in a restaurant. An order comes in for eggs and toast.

•Synchronous: you cook the eggs, then you cook the toast.

•Asynchronous, single threaded: you start the eggs cooking and set a timer. You start the toast cooking, and set a timer. While they are both cooking, you clean the kitchen. When the timers go off you take the eggs off the heat and the toast out of the toaster and serve them.

•Asynchronous, multithreaded: you hire two more cooks, one to cook eggs and one to cook toast. Now you have the problem of coordinating the cooks so that they do not conflict with each other in the kitchen when sharing resources. And you have to pay them.



Now does it make sense that multithreading is only one kind of asynchrony? Threading is about workers; asynchrony is about tasks. In multithreaded workflows you assign tasks to workers. In asynchronous single-threaded workflows you have a graph of tasks where some tasks depend on the results of others; as each task completes it invokes the code that schedules the next task that can run, given the results of the just-completed task. But you (hopefully) only need one worker to perform all the tasks, not one worker per task.



It will help to realize that many tasks are not processor-bound. For processor-bound tasks it makes sense to hire as many workers (threads) as there are processors, assign one task to each worker, assign one processor to each worker, and have each processor do the job of nothing else but computing the result as quickly as possible. But for tasks that are not waiting on a processor, you don't need to assign a worker at all. You just wait for the message to arrive that the result is available and do something else while you're waiting. When that message arrives then you can schedule the continuation of the completed task as the next thing on your to-do list to check off.



So let's look at Jon's example in more detail. What happens?

•Someone invokes DisplayWebSiteLength. Who? We don't care.

•It sets a label, creates a client, and asks the client to fetch something. The client returns an object representing the task of fetching something. That task is in progress.

•Is it in progress on another thread? Probably not. Read the link to Stephen's article on why there is no thread.

•Now we await the task. What happens? We check to see if the task has completed between the time we created it and we awaited it. If yes, then we fetch the result and keep running. Let's suppose it has not completed. We sign up the remainder of this method as the continuation of that task and return.

•Now control has returned to the caller. What does it do? Whatever it wants.

•Now suppose the task completes. How did it do that? Maybe it was running on another thread, or maybe the caller that we just returned to allowed it to run to completion on the current thread. Regardless, we now have a completed task.

•The completed task asks the correct thread -- again, likely the only thread -- to run the continuation of the task.

•Control passes immediately back into the method we just left at the point of the await. Now there is a result available so we can assign text and run the rest of the method.



It's just like in my analogy. Someone asks you for a document. You send away in the mail for the document, and keep on doing other work. When it arrives in the mail you are signaled, and when you feel like it, you do the rest of the workflow -- open the envelope, pay the delivery fees, whatever. You don't need to hire another worker to do all that for you.



WEBAPI &AD:










Refresh tokens:



No comments:

Post a Comment