tag:blogger.com,1999:blog-50193571359765157182024-03-14T09:47:00.821+05:30Portal And Content ManagementThis site contains information of .NET,Sharepoint,C#,SQL Server,MOSS,WSS,WWF,WCF,WPF,AJAX,Javascript and Adobe Flex.Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.comBlogger297125tag:blogger.com,1999:blog-5019357135976515718.post-27936207340687745442023-04-19T14:13:00.004+05:302023-04-19T14:13:46.364+05:30.NEt Core 6- Routing<p> <span style="background-color: white; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px;">Routing is a process of matching incoming HTTP requests by checking the HTTP method and url; and then invoking corresponding endpoints (middlewares).</span></p><p><span style="background-color: white; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px;"><br /></span></p><p><span style="background-color: white; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px;"><b>Example</b></span></p><p><span style="background-color: white; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px;"><u>Program.cs</u></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> //routing with default parameter with constraint</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> endpoints.Map("employee/profile/{employeename:minlength(3):maxlength(5)=Manab}", async (context) =></span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> string? employeename = Convert.ToString(context.Request.RouteValues["employeename"]);</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync($"In Profle-{employeename}");</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> });</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> //routing with optional parameter with contraint</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> endpoints.Map("products/details/{id:int?}", async (context) =></span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> if (context.Request.RouteValues.ContainsKey("id"))</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> int id = Convert.ToInt32(context.Request.RouteValues["id"]);</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync($"In produts-{id}");</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> }</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> else</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync($"In produts-id not supplied");</span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="background-color: white; font-size: 19px;"></span></span></p><p><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> });</span></span></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-33279424724332739692023-04-17T15:42:00.003+05:302023-04-17T15:42:21.953+05:30.NET Core 6- Middleware<p> <span style="background-color: white; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px;">Middleware is a component that is assembled into the application pipeline to handle requests and responses.</span></p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;">Middlewares are chained one-after-other and execute in the same sequence how they're added.</p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;">Middleware can be a request delegate (anonymous method or lambda expression) [or] a class.</p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;">Middleware class is used to separate the middleware logic from a lambda expression to a separate / reusable class.</p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;">Middleware extension method is used to invoke the middleware with a single method call.</p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;"><br /></p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;">Example</p><p style="background-color: white; box-sizing: border-box; color: #1c1d1f; font-family: "udemy sans", "sf pro text", -apple-system, BlinkMacSystemFont, Roboto, "segoe ui", Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-size: 19px; margin: 0px; max-width: none; padding: 0px;"><u>Program.cs</u></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">using MyFirstApp.CustomMiddleware;</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">var builder = WebApplication.CreateBuilder(args);</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">builder.Services.AddTransient<MyCustomMiddleware>();//Add custom middleware using DI</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">var app = builder.Build();</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//app.MapGet("/", () => "Hello World!");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//Request Response Modification</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">/*app.Run(async (HttpContext context) =></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">{</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> context.Response.StatusCode = 400;</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> context.Response.Headers["MyKey"] = "my value";</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("<h1>Hello</h1>");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("World");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">}</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">);*/</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//Middleware: Teminal or short circuit, it will not forward the request of the next middleware, so only render Hello</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">/*app.Run(async(HttpContext context) => {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("Hello");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">});</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">app.Run(async (HttpContext context) => {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("Hello again");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">});</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">*/</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//Middleware Chain: O/p without queryString = From Middleware1 My custom middleware- starts From Middleware1 My custom middleware- ends. NOTE: data type HttpContext and RequestDelegate are optional</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">app.Use(async (HttpContext context, RequestDelegate next) => {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("From Middleware1 ");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await next(context);</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">});</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//Middleware in custom class</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//app.UseMiddleware<MyCustomMiddleware>();//without extension method, Option1</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//app.UseMyCustomMiddleware();//Using extension method,Option2</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//app.UseHelloCustomMiddleware();//use VS generated middleware class, Option3</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">//Middleware useWhen, O/p: From Middleware1 -Hello from Middleware Branch- From Middleware12 </span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">app.UseWhen(context=>context.Request.Query.ContainsKey("userName"),</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> app => {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> app.Use(async (context, next) =></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("-Hello from Middleware Branch-");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await next(context);</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> });</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> });</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><br /></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">app.Run(async (HttpContext context) => {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync(" From Middleware12 ");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">});</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><br /></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">app.Run();</span></span></p><div><br /></div><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"><u>MyCustomMiddleware.cs</u></span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">namespace MyFirstApp.CustomMiddleware</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">{</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> public class MyCustomMiddleware : IMiddleware</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> public async Task InvokeAsync(HttpContext context, RequestDelegate next)</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("My custom middleware- starts");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await next(context);</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> await context.Response.WriteAsync("My custom middleware- ends");</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> } </span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> }</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> public static class CustomMiddlewareExtension</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> public static IApplicationBuilder UseMyCustomMiddleware(this IApplicationBuilder app) {</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> return app.UseMiddleware<MyCustomMiddleware>();</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> }</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;"> }</span></span></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"></p><p style="background-color: white; box-sizing: border-box; margin: 0px; max-width: none; padding: 0px;"><span style="color: #1c1d1f; font-family: udemy sans, sf pro text, -apple-system, BlinkMacSystemFont, Roboto, segoe ui, Helvetica, Arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol;"><span style="font-size: 19px;">}</span></span></p><div><br /></div><div><u>HelloCustomMiddleware.cs</u></div><div><div>using Microsoft.AspNetCore.Builder;</div><div>using Microsoft.AspNetCore.Http;</div><div>using System.Linq;</div><div>using System.Threading.Tasks;</div><div>//generated automatically from add new item-?Middleware class</div><div>namespace MyFirstApp.CustomMiddleware</div><div>{</div><div> // You may need to install the Microsoft.AspNetCore.Http.Abstractions package into your project</div><div> public class HelloCustomMiddleware</div><div> {</div><div> private readonly RequestDelegate _next;</div><div><br /></div><div> public HelloCustomMiddleware(RequestDelegate next)</div><div> {</div><div> _next = next;</div><div> }</div><div><br /></div><div> public async Task Invoke(HttpContext httpContext)</div><div> {</div><div> if(httpContext.Request.Query.ContainsKey("firstName")</div><div> && httpContext.Request.Query.ContainsKey("lastName"))</div><div> {</div><div> string fullName = httpContext.Request.Query</div><div> ["firstName"] + " " +</div><div> httpContext.Request.Query["lastName"];</div><div> await httpContext.Response.WriteAsync(fullName);</div><div> }</div><div><br /></div><div> await _next(httpContext);</div><div> }</div><div> }</div><div><br /></div><div> // Extension method used to add the middleware to the HTTP request pipeline.</div><div> public static class HelloCustomMiddlewareExtensions</div><div> {</div><div> public static IApplicationBuilder UseHelloCustomMiddleware(this IApplicationBuilder builder)</div><div> {</div><div> return builder.UseMiddleware<HelloCustomMiddleware>();</div><div> }</div><div> }</div><div>}</div><div style="text-decoration-line: underline;"><br /></div></div><div style="text-decoration-line: underline;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEr6uUiyKz2Ez6zBoDc2kYJUhmsW2en33SjX-JmkHFlLfg65A6IEwF40fi2TZBvHVZYM5ANsDcYgnOln9vxj0xd856tag7K9tGl8eoYARHFO3NKW0yAiwlvJqwb4iuc6KYRKI-nDqnr5xyUK0XAxRnWcpUJd2qmIY75yQGSsvjzEAL-oK-5H8nCfFI/s1121/MiddlewareSequence.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="628" data-original-width="1121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEr6uUiyKz2Ez6zBoDc2kYJUhmsW2en33SjX-JmkHFlLfg65A6IEwF40fi2TZBvHVZYM5ANsDcYgnOln9vxj0xd856tag7K9tGl8eoYARHFO3NKW0yAiwlvJqwb4iuc6KYRKI-nDqnr5xyUK0XAxRnWcpUJd2qmIY75yQGSsvjzEAL-oK-5H8nCfFI/s16000/MiddlewareSequence.png" /></a></div><br /><div style="text-decoration-line: underline;"><br /></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-76364741624961713522021-05-03T00:09:00.002+05:302021-05-03T00:41:41.617+05:30My Azure Study Note - 15 - Messaging- Service Bus, Event Hubs<p><b>Service Bus</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Fully managed, full blown message queueing service</p><p>• Durable</p><p>• Supports point-to-point (Queue) and pub/sub (Topic) scenarios</p><p>• Compatible with AMQP protocol</p><p>• Compatible with JMS 2.0 API (Premium only)</p></blockquote><p><br /></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPB6vey3q3ZKVaN9yskiHJmJFcwCmeX1cTHN-SKcr86AamImgbm5ga1zE169azI-dKErQR5j41oABlYBbakPW8ubESfYWUqQXe2sY8COX6UZLSvW0alKZpDoqjwhB1n8CraMpjJNs0UQc/s1099/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="654" data-original-width="1099" height="380" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPB6vey3q3ZKVaN9yskiHJmJFcwCmeX1cTHN-SKcr86AamImgbm5ga1zE169azI-dKErQR5j41oABlYBbakPW8ubESfYWUqQXe2sY8COX6UZLSvW0alKZpDoqjwhB1n8CraMpjJNs0UQc/w640-h380/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI0HmBgFmplaf_WocrTHoHDGl7uOBMNGGuionkApHAzP4Dp-aea85eJcU403dMhmXlHixU-ZmR4M-cr5z4q6crQtiZBxAhjfLjijxeKK1jH8LAUtIprQQzkvnKhnupbZuBXAQV-fJBkvI/s1062/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="615" data-original-width="1062" height="370" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI0HmBgFmplaf_WocrTHoHDGl7uOBMNGGuionkApHAzP4Dp-aea85eJcU403dMhmXlHixU-ZmR4M-cr5z4q6crQtiZBxAhjfLjijxeKK1jH8LAUtIprQQzkvnKhnupbZuBXAQV-fJBkvI/w640-h370/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /> Advanced features:<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div>• Message sessions (guarantees FIFO)</div><div>• Dead-letter queue</div><div>• Scheduled delivery</div><div>• Transactions</div><div>• Duplicate detection</div><div>• And more…</div></blockquote><p>Availability:</p><p>• SLA: 99.9%</p><p>• Can be configured for geo-disaster recovery </p><p><br /></p><p><b>Event Hubs</b></p><p><b>•</b> Big Data streaming platform and event ingestion service</p><p>• Note: No “messaging” in the description</p><p>• Basically a managed Kafka implementation</p><p>• Can receive millions of events per second</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLmybJStOUY-viEV3AvOBkkuk_W8B86b9TK1CLd8h-Iu3CEXYS7izwFv39657fuWJKvzqgjp_TTDvfHY80G6ONdnWLFHOMFzRrb2gGDnsI2zzW0xQg8E10c_wsFV274RaY_VI__jcgNY4/s1201/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="420" data-original-width="1201" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLmybJStOUY-viEV3AvOBkkuk_W8B86b9TK1CLd8h-Iu3CEXYS7izwFv39657fuWJKvzqgjp_TTDvfHY80G6ONdnWLFHOMFzRrb2gGDnsI2zzW0xQg8E10c_wsFV274RaY_VI__jcgNY4/w640-h224/AG.png" width="640" /></a></div><div><b>Event Producers</b></div><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div>- Components generating the events</div><div>- Can be done by anyone with the client /</div><div>HTTP client</div><div>- Simple connection and API</div></blockquote><p><b>Partition</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>- Single event stream</p><p>- Can think of it as a single queue</p><p>- Guarantees order</p><p>- Limited availability</p><p>- Better to spread messages across</p><p>partitions to improve availability</p><p>- …but then order is not guaranteed</p><p>- Max 32 partitions on a single Event Hubs</p></blockquote><p><b>Consumer Group</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>- Logical group of receivers, belong to the</p><p>same application</p><p>- Example:</p><p>- Receivers for processing telemetry</p><p>= Consumer Group</p><p>- Receivers for storing the telemetry</p><p>= Consumer Group</p><p>- Event receiving is done via AMQP</p><p>protocol </p></blockquote><p><b>SLA:</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Basic and Standard tier: 99.95%</p><p>• Dedicated: 99.99% </p></blockquote><p><b>Event Hubs Throughput Units</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Throughput is measured in Throughput Units (TU)</p><p>• 1 TU =</p><p>• Ingress (Input) – 1MB / sec or 1000 events / sec</p><p>• Egress (Output) – 2MB / sec or 4096 events / sec</p><p>• Prepurchased, billed by the hour </p></blockquote><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-aH6rVB9fTCuexCVoqODc5t19k527HZiSJJ2oNcF91RSIq3CvlVR2Iz55UBXnH9zaLYiM7b1IrsLduBBUIsaPJXPTZgtQogeOSKEZ3DrTYtnzsBRxsm7rUZLF_zW6tjNAs4rHy9LI0WU/s1224/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="695" data-original-width="1224" height="364" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-aH6rVB9fTCuexCVoqODc5t19k527HZiSJJ2oNcF91RSIq3CvlVR2Iz55UBXnH9zaLYiM7b1IrsLduBBUIsaPJXPTZgtQogeOSKEZ3DrTYtnzsBRxsm7rUZLF_zW6tjNAs4rHy9LI0WU/w640-h364/AG.png" width="640" /></a></div><br /><p> </p><p> </p><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-84731662506803598762021-05-02T17:16:00.007+05:302021-05-02T19:24:06.991+05:30My Azure Study Note - 14 - Messaging- Event Grid<p><b>Event Grid</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Allows building event-based architectures</p><p>• Publishes events to interested parties</p><p>• No queue / no order</p><p>• Strong integration with many Azure services</p><p>• Cost effective, simple pricing</p><p>• No tiers, HA is built in</p></blockquote><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDo1esmojvnad7iY0PFSrBdgf1KyHuG31PL6u65FH82MarwrFYCQU7twILpu0reFs-3XK2jumjomNICpvyqiRLokBucy4lL6LZs1hin13UVSe16IXyY30X9X_HxKYFFojH-b_99iX0UJ4/s982/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="568" data-original-width="982" height="370" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDo1esmojvnad7iY0PFSrBdgf1KyHuG31PL6u65FH82MarwrFYCQU7twILpu0reFs-3XK2jumjomNICpvyqiRLokBucy4lL6LZs1hin13UVSe16IXyY30X9X_HxKYFFojH-b_99iX0UJ4/w640-h370/AG.png" width="640" /></a></div><br /><p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsTvWpdmCD4gqYEDQckhlWjrcV7CgTehQNmNl2sfCohC1w-xeRej7DYFjkJLB7FqHku_FqtfTYpR9SJaSLUUKodbLbVTTYYIq_xFnYVmvrqTkmkmZpZpubEcyKWwpfEUHB2xmu-ZpYXV8/s1034/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="648" data-original-width="1034" height="402" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsTvWpdmCD4gqYEDQckhlWjrcV7CgTehQNmNl2sfCohC1w-xeRej7DYFjkJLB7FqHku_FqtfTYpR9SJaSLUUKodbLbVTTYYIq_xFnYVmvrqTkmkmZpZpubEcyKWwpfEUHB2xmu-ZpYXV8/w640-h402/AG.png" width="640" /></a></div><br /><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEORasdPxvSphSwu8QLSiJpqikLtgHmCDWm3oT5Z0JjNYcBQHHULYiQjCi3KJD0YEK6QUefcBZuvQArID9L47A-nH06I9aze_GpEIvmPXcRG0bV7Hh1_eP-HNSKeKONn751XHAi22rhM4/s1125/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="560" data-original-width="1125" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEORasdPxvSphSwu8QLSiJpqikLtgHmCDWm3oT5Z0JjNYcBQHHULYiQjCi3KJD0YEK6QUefcBZuvQArID9L47A-nH06I9aze_GpEIvmPXcRG0bV7Hh1_eP-HNSKeKONn751XHAi22rhM4/w640-h318/AG.png" width="640" /></a></div><div><b>SLA:</b></div><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div>• 99.99%</div><div>• Max event size:</div><div>• 1MB</div></blockquote><p><b>Event Grid</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Performance:</p><p>• 10,000,000 events / sec</p><p>• 5,000 events / sec / topic</p><p>• Latency:</p><p>• Subsecond end-to-end latency in the 99th percentile </p></blockquote><p><b>Event Grid Pricing</b></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Based on:</p><p>• Number of operations</p><p>• First 100K operations are free </p></blockquote><p><b> Create Event Grid</b></p><p>The event will be triggered when some item will be added to the storage account and write to the cosmos db</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn9LFX_aDrsyufLbeh4DXhj6j7Rs7fxNIPYCPkCKK-whM_-sU952RQInEEYV8tUJmHGx5MGl-uThPY2Fm7HbecYhVVgaWvXAIHbUWWNGpZ_K5RjqnzpxUjkmRT4sfAmNYGxnQ_etpTLs4/s755/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="583" data-original-width="755" height="494" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn9LFX_aDrsyufLbeh4DXhj6j7Rs7fxNIPYCPkCKK-whM_-sU952RQInEEYV8tUJmHGx5MGl-uThPY2Fm7HbecYhVVgaWvXAIHbUWWNGpZ_K5RjqnzpxUjkmRT4sfAmNYGxnQ_etpTLs4/w640-h494/AG.png" width="640" /></a></div><br /><p>Install package- Microsoft.Azure.Webjobs.Extensions.EventGrid</p><p>Copy the connection strings</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_NXesqmOjmmSpsYmqi_ExVTVGrjmkbaRyOZdUAWxYKW0edRgNDP7wuQ5p4lSdajb9x0DejKHuIgiw4Bva1N5mlLExLgEH7ziOlLdxdbYbopiUi7LKpjVJk8CX-AUNQ492x3nQsZPL9tU/s1887/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="642" data-original-width="1887" height="218" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_NXesqmOjmmSpsYmqi_ExVTVGrjmkbaRyOZdUAWxYKW0edRgNDP7wuQ5p4lSdajb9x0DejKHuIgiw4Bva1N5mlLExLgEH7ziOlLdxdbYbopiUi7LKpjVJk8CX-AUNQ492x3nQsZPL9tU/w640-h218/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0OlhaxLx7L0-2rW575hB3voIuRBr5Bqn66-xlZveGuEij0ZUoNKgG7ubCrc4v6nZFnoC1yDt9adJ4JzDS_7lYijKZFcRLK-eRLAM69_9p3lPbWOoOp9M6DO76w3FDFPw-O_WbtLJnVUc/s1849/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="711" data-original-width="1849" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0OlhaxLx7L0-2rW575hB3voIuRBr5Bqn66-xlZveGuEij0ZUoNKgG7ubCrc4v6nZFnoC1yDt9adJ4JzDS_7lYijKZFcRLK-eRLAM69_9p3lPbWOoOp9M6DO76w3FDFPw-O_WbtLJnVUc/w640-h246/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjoQZ7qG9kgmSEUmSXFt9g0o6lqXVk_usZe7KM-wb6vGi9e0DQNqeSJAqWF8H3hdMcpdH8o5zlDRPrnyt4kh3XQO08hiHTMyzaVqdKJRElXIY5dO6ztBwaoWTjDUK3pLY558JyXO_l1No/s1780/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="443" data-original-width="1780" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjoQZ7qG9kgmSEUmSXFt9g0o6lqXVk_usZe7KM-wb6vGi9e0DQNqeSJAqWF8H3hdMcpdH8o5zlDRPrnyt4kh3XQO08hiHTMyzaVqdKJRElXIY5dO6ztBwaoWTjDUK3pLY558JyXO_l1No/w640-h160/AG.png" width="640" /></a></div><br /><p>ProcessOrderCosmos.cs</p><p>using Microsoft.Azure.WebJobs;</p><p>using Microsoft.Azure.WebJobs.Extensions.Http;</p><p>using Microsoft.AspNetCore.Http;</p><p>using Microsoft.Extensions.Logging;</p><p>using System.Threading.Tasks;</p><p>using System;</p><p>using System.IO;</p><p>using Newtonsoft.Json;</p><p>using System.Collections.Generic;</p><p>using Microsoft.Azure.WebJobs.Extensions.EventGrid;</p><p>using Microsoft.Azure.EventGrid.Models;</p><p>using Microsoft.Azure.Storage.Blob;</p><p><br /></p><p>namespace AzureCourse.Function</p><p>{</p><p> public static class CosmosOrderFunction</p><p> {</p><p> [FunctionName("ProcessOrderCosmos")]</p><p> public static void Run(</p><p> [EventGridTrigger]EventGridEvent eventGridEvent,</p><p> [Blob("neworders", FileAccess.Write, Connection = "StorageConnectionString")] CloudBlobContainer container,</p><p> [CosmosDB(databaseName: "readit-orders", collectionName: "orders", ConnectionStringSetting = "CosmosDBConnection")]out Order order,</p><p> ILogger log) </p><p> { </p><p><br /></p><p> order=null;</p><p><br /></p><p> try { </p><p> log.LogInformation("Function started");</p><p> log.LogInformation($"Event details: Topic: {eventGridEvent.Topic}");</p><p> log.LogInformation($"Event data: {eventGridEvent.Data.ToString()}");</p><p><br /></p><p> string eventBody = eventGridEvent.Data.ToString(); </p><p><br /></p><p> log.LogInformation("Deserializing to StorageBlobCreatedEventData...");</p><p> var storageData=JsonConvert.DeserializeObject<StorageBlobCreatedEventData>(eventBody); </p><p> log.LogInformation("Done");</p><p><br /></p><p> log.LogInformation("Get the name of the new blob...");</p><p> var blobName=Path.GetFileName(storageData.Url);</p><p> log.LogInformation($"Name of file: {blobName}");</p><p><br /></p><p> log.LogInformation("Get blob from storage...");</p><p> var blockBlob=container.GetBlockBlobReference(blobName);</p><p> var orderText=blockBlob.DownloadText();</p><p> log.LogInformation("Done");</p><p> log.LogInformation($"Order text: {orderText}");</p><p> </p><p> order=JsonConvert.DeserializeObject<Order>(orderText); </p><p> }</p><p> catch (Exception ex) {</p><p> log.LogError(ex, "Error in function");</p><p> } </p><p> }</p><p> } </p><p>}</p><p><b>Create Event Subscription</b></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgexo8wPe9zBBwBAohlBrGKzAOwPQGCQ0l6XFeAfTH6ankkNSwMG0RAael1gnDCdky786ZcVn0eByfHIzvd9b-idCwBJau0Ofb0xfDzu23J__p3IiXyvJUut6bBOQXVccGDX8Z5-JbNwYs/s1041/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="668" data-original-width="1041" height="410" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgexo8wPe9zBBwBAohlBrGKzAOwPQGCQ0l6XFeAfTH6ankkNSwMG0RAael1gnDCdky786ZcVn0eByfHIzvd9b-idCwBJau0Ofb0xfDzu23J__p3IiXyvJUut6bBOQXVccGDX8Z5-JbNwYs/w640-h410/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB4C-Uqe4C5-WEyiA423Ed4zvU2Y9m4XnmQEz4Zjt4RvsgPW1QG2vS5S-10P0irIB2kh5RC8kA6TSXWZLCK15YQVvDWbvyYmHthJd1TcGM6SeqwqVse8HvNgpn0vN1UDFzfJXjoeqa5nw/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB4C-Uqe4C5-WEyiA423Ed4zvU2Y9m4XnmQEz4Zjt4RvsgPW1QG2vS5S-10P0irIB2kh5RC8kA6TSXWZLCK15YQVvDWbvyYmHthJd1TcGM6SeqwqVse8HvNgpn0vN1UDFzfJXjoeqa5nw/w640-h360/AG.png" width="640" /></a></div><br /><b><br /></b><p></p><p> Now Upload a file azure storage account->Container, check the function app log and check the cosmos DB</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkY_W1pnRQkXS7xiw6VJrrLIq4Qqkayv2OkoF2MtzVLSivKJrkG5dHyfzv8fg84LfhN7EAjeYjKZzDzLLDOy5EoXKBbIO1TLw0Dif36mYbot0xBOgyhZnH6TBzg-sEhm9LXBWLpmWkig/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkY_W1pnRQkXS7xiw6VJrrLIq4Qqkayv2OkoF2MtzVLSivKJrkG5dHyfzv8fg84LfhN7EAjeYjKZzDzLLDOy5EoXKBbIO1TLw0Dif36mYbot0xBOgyhZnH6TBzg-sEhm9LXBWLpmWkig/w640-h360/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHJg5RMIg09sqGrFEpa86w2QJmkwlzFeVbI87Hut2LYNG9Rkr3TayuRs9IoqdUC_Cu_gUQwBAOR9FUuYa5ZDE8kvmf7JjFY08EA7iFFMiqAwH-jWi6WIq_y3Z9LdGHXw6BuPxksOHYnFs/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHJg5RMIg09sqGrFEpa86w2QJmkwlzFeVbI87Hut2LYNG9Rkr3TayuRs9IoqdUC_Cu_gUQwBAOR9FUuYa5ZDE8kvmf7JjFY08EA7iFFMiqAwH-jWi6WIq_y3Z9LdGHXw6BuPxksOHYnFs/w640-h360/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKyUsRTVBbfD-zkNM8xjzk6DqzW_zDMmpcjJ3DG2YSarK_L6BmQVRZtZ3m13F5dG6WDUnoPCpQzArq-suS4XcJjwHhe3BoGsXSqITgSmP5KdytgRahI5-89U_w1YNzWBxAo3rNJ-VJFHU/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKyUsRTVBbfD-zkNM8xjzk6DqzW_zDMmpcjJ3DG2YSarK_L6BmQVRZtZ3m13F5dG6WDUnoPCpQzArq-suS4XcJjwHhe3BoGsXSqITgSmP5KdytgRahI5-89U_w1YNzWBxAo3rNJ-VJFHU/w640-h360/AG.png" width="640" /></a></div><br /><p><br /></p><p>Content of the uploaded json file as below</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3etF65eU28_i_5pxp2NvSDck5vyX8NZrkDhGxobIOymO8cpRNs4vI-dmCiwJ9KE1YlFN3RR6BwHM-BATNi36ph0TxsEdAljMYOKrbKeXF86JL4_kKa-ppD63s9zPTb9s1Z8pemEPMqM/s568/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="334" data-original-width="568" height="376" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3etF65eU28_i_5pxp2NvSDck5vyX8NZrkDhGxobIOymO8cpRNs4vI-dmCiwJ9KE1YlFN3RR6BwHM-BATNi36ph0TxsEdAljMYOKrbKeXF86JL4_kKa-ppD63s9zPTb9s1Z8pemEPMqM/w640-h376/AG.png" width="640" /></a></div><br /><p><br /></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-79467012774311592922021-05-02T15:38:00.009+05:302021-05-02T16:40:08.816+05:30My Azure Study Note - 13 - Messaging, Storage Queue<p><b>Messaging in Azure</b></p><p>Azure has 4 fully managed messaging services</p><p></p><ol style="text-align: left;"><li>Storage Queue</li><li>Service Bus</li><li>Events Grid</li><li>Event Hubs</li></ol><p></p><div><b>Storage Queue</b></div><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div><div>• Part of Azure Storage Account</div></div><div><div>• The simplest queue implementation</div></div><div><div>• Create queue -> Send Message -> Receive message</div></div><div><div>• No special pricing for queue, included in Storage Account</div></div><div><div>• Same for availability</div></div></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>Performance:</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• Requests (1KB msg)</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• 20K msgs / sec / account</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>• 2K msgs / sec / queue</p></blockquote><p>• Max msg size: 64KB </p><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9ml1IxOU7GzH_4EJkXHiXIo-Wbb4Kt3h7jCW_1_k1yEv1XNx5-Qv6PS_QgJMjhn7mV8Rx_4lppBt4cZECdBRJ49hA7KfE3dDSyElao21zkYIRdW9Ju5zVfiO4-cNA_Te9_xxBoxbMvh8/s1004/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="427" data-original-width="1004" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9ml1IxOU7GzH_4EJkXHiXIo-Wbb4Kt3h7jCW_1_k1yEv1XNx5-Qv6PS_QgJMjhn7mV8Rx_4lppBt4cZECdBRJ49hA7KfE3dDSyElao21zkYIRdW9Ju5zVfiO4-cNA_Te9_xxBoxbMvh8/w400-h170/AG.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;">Development:</div></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;">• Client libraries for many development languages</div></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;">• .NET, Java, Python, NodeJS, C++, PHP, Ruby</div></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;">• Extremely simple object model</div></div></blockquote><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;"><b>Create a Storage Queue</b></div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">Step 1: Create a storage account</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTfHyatpzb1FlU2o_J_5xPGTyMBQ2QZkt01v8wk7nVijBtaKPOHRZc8oYW7jqExmSBeemmCldbXnXInFj_EY9hwP7Tc5Bk0BdNmSKehqnekuNtfU5fHE0e_SA1w6CKlWLr2DDB1eCvolo/s823/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="823" data-original-width="703" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTfHyatpzb1FlU2o_J_5xPGTyMBQ2QZkt01v8wk7nVijBtaKPOHRZc8oYW7jqExmSBeemmCldbXnXInFj_EY9hwP7Tc5Bk0BdNmSKehqnekuNtfU5fHE0e_SA1w6CKlWLr2DDB1eCvolo/w546-h640/AG.png" width="546" /></a></div><br /><div class="separator" style="clear: both;"><br /></div></div><div class="separator" style="clear: both; text-align: left;">Step 2 : Click on Queues</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiornB2DZeBQ2h-Z7wi6s04ZbFluPnLWtn4Xpojd_FCTKlPeh4UAncqxM2Gdt_ShokOro315uISeV1AGaqFlShpM0ThlP2HGzEty1YEEQhTOochwDco8hP5vA1-GDgOTIQvyMVnE2_K4Hs/s883/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="429" data-original-width="883" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiornB2DZeBQ2h-Z7wi6s04ZbFluPnLWtn4Xpojd_FCTKlPeh4UAncqxM2Gdt_ShokOro315uISeV1AGaqFlShpM0ThlP2HGzEty1YEEQhTOochwDco8hP5vA1-GDgOTIQvyMVnE2_K4Hs/w640-h310/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div>Step 3 : Add a queue<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTGqVovjpFqSGN2MIJAR9QMXJcOD5YPx5ZF4M2tgUE3xl5NiGnpD3p_LmXEjsfrYLCfvwtf5k5Xw3YRT3IMp_hlWeCMgdFd_9qy2QNSBb7o68AAoCJqs-9y5OoYqCHRDRCHJP-Wgpcyak/s479/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="292" data-original-width="479" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTGqVovjpFqSGN2MIJAR9QMXJcOD5YPx5ZF4M2tgUE3xl5NiGnpD3p_LmXEjsfrYLCfvwtf5k5Xw3YRT3IMp_hlWeCMgdFd_9qy2QNSBb7o68AAoCJqs-9y5OoYqCHRDRCHJP-Wgpcyak/w640-h390/AG.png" width="640" /></a></div><br /><div><br /><p>Step 4. Add message</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivhaJtMOAPgpKfqTwH4a4iEVJ0MnqxS7pOLNJpz0HjGt213zwSals8_MC4qgSGbM6QfvkBuCX3pffwXi1Q_e2S0b9OSGmeSOF71jNDH96YhmTaDC5yYEeQMoZJuuyZQrPJ9W9udpfazUw/s716/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="587" data-original-width="716" height="524" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivhaJtMOAPgpKfqTwH4a4iEVJ0MnqxS7pOLNJpz0HjGt213zwSals8_MC4qgSGbM6QfvkBuCX3pffwXi1Q_e2S0b9OSGmeSOF71jNDH96YhmTaDC5yYEeQMoZJuuyZQrPJ9W9udpfazUw/w640-h524/AG.png" width="640" /></a></div><br /><p>Step 5. Read Message from queue</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMeCIeE1Kl44Yqa-7jm6nkSAwJzfQO5ZPtpajKlQFmfOEr-3kclcdaKCUNjOU812pRZZxKpM5AydfKyAW6sC7humHeLsl4WkjiaiXHbMOkYo3odaQYMvnV4IUNfdViXZCQrAX9MiSy2fY/s1246/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="756" data-original-width="1246" height="389" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMeCIeE1Kl44Yqa-7jm6nkSAwJzfQO5ZPtpajKlQFmfOEr-3kclcdaKCUNjOU812pRZZxKpM5AydfKyAW6sC7humHeLsl4WkjiaiXHbMOkYo3odaQYMvnV4IUNfdViXZCQrAX9MiSy2fY/w640-h389/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Step 6. Copy connection string and paste it to the above connection string, run the programme</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_8wpy_l4JSFnpHm9s_6rcf0905yULaCPURXF3GzQuj1iRUeLIcxJsyQ4HCN7TuotNfqTvksIKJBlZ_wxC7eKpm9_tXqjqzOnYAYndUAeI7Jmh2LOJ5HbeCA8evUgMkGKxJWAisLiCyZ4/s1812/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="631" data-original-width="1812" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_8wpy_l4JSFnpHm9s_6rcf0905yULaCPURXF3GzQuj1iRUeLIcxJsyQ4HCN7TuotNfqTvksIKJBlZ_wxC7eKpm9_tXqjqzOnYAYndUAeI7Jmh2LOJ5HbeCA8evUgMkGKxJWAisLiCyZ4/w640-h222/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><br /></div>Step 7. Refresh the queue in azure and you can see nothing in the queue.</div><div>Write some new messages but you can see nothing appears in azure because as soon as we will write the message, it will be continiously pulling by the programme.<br /><p><br /></p></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-59070023748537051602021-05-02T01:25:00.005+05:302021-05-02T02:27:11.235+05:30My Azure Study Note - 12 - Cosmos DB<p> <span face=""Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif" style="background-color: white; color: #171717; font-size: 16px;">Azure Cosmos DB is a fully managed NoSQL database for modern app development.</span><span face=""Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif" style="background-color: white; color: #171717; font-size: 16px;"> </span></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcnIZUiDluRD-7V-hsC9Z83lSBSt2r-C6VHV0fya3vPRSHlFn4fw5VnNhEmUWhL1h_mOpjTKgTfjdwJsR15UHEo4ZK0Dm8nyrTCzI0nZx-xH83Af4mllm-6aC2fJ3tq_PnqQpDrl4-UfE/s785/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="549" data-original-width="785" height="280" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcnIZUiDluRD-7V-hsC9Z83lSBSt2r-C6VHV0fya3vPRSHlFn4fw5VnNhEmUWhL1h_mOpjTKgTfjdwJsR15UHEo4ZK0Dm8nyrTCzI0nZx-xH83Af4mllm-6aC2fJ3tq_PnqQpDrl4-UfE/w400-h280/AG.png" width="400" /></a></div><br /><span face=""Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif" style="background-color: white; color: #171717; font-size: 16px;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_wdqda8y9ZYYtnha2Pw7XWpgt_IqDQL7i_8m_JQfDgSaA-TM9llcCTHw8sg0BIcfX4xiEN32c0eytLRn8grp1o2Q59WFTKh_p2-uYZhItTzsncKxlTH1U9-etLnm6IBXoKbDs-0f4ftM/s1692/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="838" data-original-width="1692" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_wdqda8y9ZYYtnha2Pw7XWpgt_IqDQL7i_8m_JQfDgSaA-TM9llcCTHw8sg0BIcfX4xiEN32c0eytLRn8grp1o2Q59WFTKh_p2-uYZhItTzsncKxlTH1U9-etLnm6IBXoKbDs-0f4ftM/w400-h198/AG.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFyrObkT0Lk-6HuxcjoDgVmttlWKJa8mXbzUIHg0emO3GLn_iidtl5FX8i3goOQZzOU1u_1Ty23UVA1_tnjl_sbMpO5uI0wWq2aRMRSvRRMPEzuC94jM4Ioq8PoAJWvMCoD-be87TDuv0/s1689/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="995" data-original-width="1689" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFyrObkT0Lk-6HuxcjoDgVmttlWKJa8mXbzUIHg0emO3GLn_iidtl5FX8i3goOQZzOU1u_1Ty23UVA1_tnjl_sbMpO5uI0wWq2aRMRSvRRMPEzuC94jM4Ioq8PoAJWvMCoD-be87TDuv0/w400-h236/AG.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0c33i0gamoiGUwcOrseWcVtyDyY0ApFXCYxWPbwFdcRjA1w1yFpUGuVIugSoz-DZTIIHPQ-3-q-1QeeBpXAoP0KTWpxMShVG9D32XaEjiwRzYDwmVJV9DeYuOeo-CTqLMlXBMD9999ko/s1541/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="401" data-original-width="1541" height="104" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0c33i0gamoiGUwcOrseWcVtyDyY0ApFXCYxWPbwFdcRjA1w1yFpUGuVIugSoz-DZTIIHPQ-3-q-1QeeBpXAoP0KTWpxMShVG9D32XaEjiwRzYDwmVJV9DeYuOeo-CTqLMlXBMD9999ko/w400-h104/AG.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhtxrNApVB1iUg4FoEDPgotEYHYq8dlQ1IRNqoj2VaOBJUdnFMzABZZA3V5ldBG0B4duiuhPeTyRfxTtYESUpb4_rMyvlmjSmrbOASuQBx_6Jt3ZgZSngLq940Srs3RioxPNURFMMyxtw/s1711/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="989" data-original-width="1711" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhtxrNApVB1iUg4FoEDPgotEYHYq8dlQ1IRNqoj2VaOBJUdnFMzABZZA3V5ldBG0B4duiuhPeTyRfxTtYESUpb4_rMyvlmjSmrbOASuQBx_6Jt3ZgZSngLq940Srs3RioxPNURFMMyxtw/w400-h231/AG.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div></span><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXDMsmxjuLoSebkAG1fiolbwhw8Fza616ULJrh-j4Sv1Emo19UQ0TiURZmhEA8lttwrVv-ZXB7RpbsMRWS_yLQSjP8XkRaON4GLU71Hrxj6xdWPj84RQym8OwpRksf1q-F8jRDnBzDW4/s1747/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1009" data-original-width="1747" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXDMsmxjuLoSebkAG1fiolbwhw8Fza616ULJrh-j4Sv1Emo19UQ0TiURZmhEA8lttwrVv-ZXB7RpbsMRWS_yLQSjP8XkRaON4GLU71Hrxj6xdWPj84RQym8OwpRksf1q-F8jRDnBzDW4/s320/AG.png" width="320" /></a></div><b>Create Cosmos DB</b><p></p><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHGbXMV5SX_zyfH5Tp2aMnFJKQJFGqBUrT-Hy6ji0SLhgifx0msqPCuUaux1fUqLeo16ZaZTRc0uBvDJXERcUBUSJmaTNEi4gJu2Vnx5xXOXZo7YD4KRDyx2tQ8-Kk6zXuT3CzZCOGdAI/s1281/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="863" data-original-width="1281" height="432" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHGbXMV5SX_zyfH5Tp2aMnFJKQJFGqBUrT-Hy6ji0SLhgifx0msqPCuUaux1fUqLeo16ZaZTRc0uBvDJXERcUBUSJmaTNEi4gJu2Vnx5xXOXZo7YD4KRDyx2tQ8-Kk6zXuT3CzZCOGdAI/w640-h432/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: left;"><b>Create DB</b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3irIp7vveSkPiSYaZpYUcHj57_Z1OZfaj7HXZNuiiTNP1YQqYMO3Q_1X4VOAiUiPBWk_JcyJSF2E6ki2LaRq8CORXyJu_sf6itS9Y5yC0HTBJNsCCy7FF817AX5x7A6Fx-oj7tPzelHo/s1839/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="640" data-original-width="1839" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3irIp7vveSkPiSYaZpYUcHj57_Z1OZfaj7HXZNuiiTNP1YQqYMO3Q_1X4VOAiUiPBWk_JcyJSF2E6ki2LaRq8CORXyJu_sf6itS9Y5yC0HTBJNsCCy7FF817AX5x7A6Fx-oj7tPzelHo/w640-h222/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><b>Create Container</b></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN50FdnlKaPWo7Ec7nNFFPFWUN8RvQJbh2F2h6DicNDPAyrEz6hgz9uqM4z3PXna4Yu-p5WgcQ0LlU7pCTGVS_4z3sQNGA_1o8_QF1nCR6ILoThpy9Ixa5qEQcvxEGcxVXyDGfxYH2zYU/s1126/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="504" data-original-width="1126" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN50FdnlKaPWo7Ec7nNFFPFWUN8RvQJbh2F2h6DicNDPAyrEz6hgz9uqM4z3PXna4Yu-p5WgcQ0LlU7pCTGVS_4z3sQNGA_1o8_QF1nCR6ILoThpy9Ixa5qEQcvxEGcxVXyDGfxYH2zYU/w640-h286/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4mmQhYvF41_R3sy6I-DZH4b97zR5miqlJ2nIz7GH0PqzbpVYYvk7ysTyfKvYXgdBkUB80LjMCINMSduFxSDBVfW_f_Fxjj_jF-G2IUujmQiOeY0DsPUCZ4eN-Mx4MowbVI-SYh9jGADM/s536/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="536" data-original-width="384" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4mmQhYvF41_R3sy6I-DZH4b97zR5miqlJ2nIz7GH0PqzbpVYYvk7ysTyfKvYXgdBkUB80LjMCINMSduFxSDBVfW_f_Fxjj_jF-G2IUujmQiOeY0DsPUCZ4eN-Mx4MowbVI-SYh9jGADM/w458-h640/AG.png" width="458" /></a></div><div class="separator" style="clear: both; text-align: left;"><b><br /></b></div><div class="separator" style="clear: both; text-align: left;"><b>Add Item</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiOpFOqqvlh1FnKgllkisLj5UXkgwHcNjPwzR4lqJaUgeK3lNqpm2HEUInQ_4T-VwhnlVXG0MVRYjjl3XTePAGHc69g-lPXNrp82ouEB7quzICIps3WDtHHYWrf1kWiLQbY7p0XqPb5uk/s1111/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="612" data-original-width="1111" height="352" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiOpFOqqvlh1FnKgllkisLj5UXkgwHcNjPwzR4lqJaUgeK3lNqpm2HEUInQ_4T-VwhnlVXG0MVRYjjl3XTePAGHc69g-lPXNrp82ouEB7quzICIps3WDtHHYWrf1kWiLQbY7p0XqPb5uk/w640-h352/AG.png" width="640" /></a></div><br /><b><br /></b></div><b>Use Query</b></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYp_crlO3qBwsdiYsim8f9mnQuezlxM93XFi4kf1M3ihDT8ZNQm8aEsNfHypfDKG-5tnA_X0N7Pr9jkf2LYjn3uPFK_wQzdksz6tFOJJk5x0ZB81AABGeCLiT0ncX35Bj1nFK5OoPZxGg/s869/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="531" data-original-width="869" height="392" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYp_crlO3qBwsdiYsim8f9mnQuezlxM93XFi4kf1M3ihDT8ZNQm8aEsNfHypfDKG-5tnA_X0N7Pr9jkf2LYjn3uPFK_wQzdksz6tFOJJk5x0ZB81AABGeCLiT0ncX35Bj1nFK5OoPZxGg/w640-h392/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><b><br /></b></div><div class="separator" style="clear: both; text-align: left;"><b>Connection String/Keys</b></div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY1lZobjpvS1WkalfdioIzwlNo7u8zgTN8VjnetJbSiA4n0y-IGpfeCueZcx1zWVabPHZZ1guLuYM_SgMtVOb5oRH9QnpAzaSxLsNg7fC8VPDwQCfLPb-0WyWvSJKYYn33n9EQlOWzR4A/s1512/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="672" data-original-width="1512" height="284" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY1lZobjpvS1WkalfdioIzwlNo7u8zgTN8VjnetJbSiA4n0y-IGpfeCueZcx1zWVabPHZZ1guLuYM_SgMtVOb5oRH9QnpAzaSxLsNg7fC8VPDwQCfLPb-0WyWvSJKYYn33n9EQlOWzR4A/w640-h284/AG.png" width="640" /></a></div><br /><b><br /></b></div><b>Add Connection in Function</b></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5tyyvtPDlS5NzorW7aXNOf-HsXVSlT8EBJovCRqOEpy1U369z3jA8p-E47N7H5j4gTdZy0lmxTmOL39WGquJaIDMUWkZGBNaLBggFgsMd9IY4K0DgHP0QHPqaOqsWmoFhxKzpu6gbkQ8/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5tyyvtPDlS5NzorW7aXNOf-HsXVSlT8EBJovCRqOEpy1U369z3jA8p-E47N7H5j4gTdZy0lmxTmOL39WGquJaIDMUWkZGBNaLBggFgsMd9IY4K0DgHP0QHPqaOqsWmoFhxKzpu6gbkQ8/w640-h360/AG.png" width="640" /></a></div><br /><b><br /><br /><br /></b><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4vv68pxnfFO_0FBQiusy-x5FWSo3hmhxakshn8astc6-1sEjWN6BBpuyP6pf64L3yHO9XNzxK3Ex-1Ag4CJZsgo3hR3X3vlxkLcTy_qO7ctQInF1FhkknEvu0_PphHU9xPz2qbbIs45U/s869/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="324" data-original-width="869" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4vv68pxnfFO_0FBQiusy-x5FWSo3hmhxakshn8astc6-1sEjWN6BBpuyP6pf64L3yHO9XNzxK3Ex-1Ag4CJZsgo3hR3X3vlxkLcTy_qO7ctQInF1FhkknEvu0_PphHU9xPz2qbbIs45U/w640-h238/AG.png" width="640" /></a></div><br /></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-37805578875684667872021-05-01T18:19:00.001+05:302021-05-01T19:52:35.348+05:30My Azure Study Note - 11 - Configure SQL<p> </p><div class="separator" style="clear: both; text-align: left;"><b>Create the DB</b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCLKgyinprnLxZfxnEu8XVZTWuh0Qa7ZHVSeZJ4NXdA_ZiVSfC6tpbr0DVDAHCZRnL15LD9GaHD988Mih-fnO_o4czcV3BsmamTDzw1nY-9OwX2sDJnOnA6iwlCG0i6QWDO_irlD5kuQI/s710/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="643" data-original-width="710" height="580" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCLKgyinprnLxZfxnEu8XVZTWuh0Qa7ZHVSeZJ4NXdA_ZiVSfC6tpbr0DVDAHCZRnL15LD9GaHD988Mih-fnO_o4czcV3BsmamTDzw1nY-9OwX2sDJnOnA6iwlCG0i6QWDO_irlD5kuQI/w640-h580/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAUorn6HgA_fDF2fAo_zXoIOCjjqsloslSc5BIM6c07rdMosSaCqQ1ICxAIKUUS2kW0pvmxEBQnR-8RpATcb5GpCmcBYlKa_VfHI4GxR9UNhIYGrkDVWqydP6Jzb2QMykucVxHo7dEkUk/s728/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="375" data-original-width="728" height="330" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAUorn6HgA_fDF2fAo_zXoIOCjjqsloslSc5BIM6c07rdMosSaCqQ1ICxAIKUUS2kW0pvmxEBQnR-8RpATcb5GpCmcBYlKa_VfHI4GxR9UNhIYGrkDVWqydP6Jzb2QMykucVxHo7dEkUk/w640-h330/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><b>Install the extension for VS Code</b></div><div class="separator" style="clear: both; text-align: left;"><b><br /></b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwlOOQjxgwDw4Ramua0FpyNeYUyTXeub7gawzPMBEIq4RdK4I9P8IHV8Vd00scd-_h32JEFEJ4u97SEt0kGKWP2moA5QVhU__TEs8vBpujA3GyiervMwuVWVhgZWJ0BEcI9NlIlgpJP_A/s729/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="362" data-original-width="729" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwlOOQjxgwDw4Ramua0FpyNeYUyTXeub7gawzPMBEIq4RdK4I9P8IHV8Vd00scd-_h32JEFEJ4u97SEt0kGKWP2moA5QVhU__TEs8vBpujA3GyiervMwuVWVhgZWJ0BEcI9NlIlgpJP_A/w640-h318/AG.png" width="640" /></a></div><br /><b>Copy the Connection string from azure and change the PASSWORD</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtbZvqTdoRg-sXqrPjajy4_Y-wpZZLwb73BxTTpxVxD3UWzaaPyUqqAcwXt2y37UmaC0Xr29-4EcXO-XVJD1zapl0qaLMuQv3zl9mmdBrCh67fikEh4EYfZvJYKil1TpkWNn72c-Fa9kI/s1752/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="638" data-original-width="1752" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtbZvqTdoRg-sXqrPjajy4_Y-wpZZLwb73BxTTpxVxD3UWzaaPyUqqAcwXt2y37UmaC0Xr29-4EcXO-XVJD1zapl0qaLMuQv3zl9mmdBrCh67fikEh4EYfZvJYKil1TpkWNn72c-Fa9kI/w640-h234/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div><b>Add the Connection</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjzmHbKLau81q4sEu_Nks8oxKzHQjxLCHRI-Ddr1tw1L_qfRI7aDw9qTB8bHebgZ5dY0l4a-pJcCBlsUjjc21rISmbIq7CTVlUb6Y4eliBKfwCilRDnZcbHTlmPibDMxUEdqPAWwp7QNg/s1266/AGNW.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="600" data-original-width="1266" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjzmHbKLau81q4sEu_Nks8oxKzHQjxLCHRI-Ddr1tw1L_qfRI7aDw9qTB8bHebgZ5dY0l4a-pJcCBlsUjjc21rISmbIq7CTVlUb6Y4eliBKfwCilRDnZcbHTlmPibDMxUEdqPAWwp7QNg/w640-h304/AGNW.png" width="640" /></a></div><br /><b><br />Error Message while trying to set the connection</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcp5SLy77ny__AcgYCwKqLQvfU88BH8HiZKqkOt5H1xC4_I0wQ6DtzIHCfX2Xg-9EE226P-nkEd4-DjpPGqvvaPinF903UMI-6AsI_FK66tX0_yRGTkxkd_1xnjPUDqHr1agOrrbcjEZM/s471/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="152" data-original-width="471" height="129" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcp5SLy77ny__AcgYCwKqLQvfU88BH8HiZKqkOt5H1xC4_I0wQ6DtzIHCfX2Xg-9EE226P-nkEd4-DjpPGqvvaPinF903UMI-6AsI_FK66tX0_yRGTkxkd_1xnjPUDqHr1agOrrbcjEZM/w400-h129/AG.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;"><b>Allow the IP</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjll9u1ae0SqLK-dpC-ZQ5Cowr9iDHRJeKG7_3jBvUyPP82y7CZymQClTJPXsfzGzC3hqczIqFYannUw5LavRL00zXe4nPXRWiWMohfx5lT0d-ldpU8QmK_nZS9NznsBzF8G0n-_EwdW78/s992/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="466" data-original-width="992" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjll9u1ae0SqLK-dpC-ZQ5Cowr9iDHRJeKG7_3jBvUyPP82y7CZymQClTJPXsfzGzC3hqczIqFYannUw5LavRL00zXe4nPXRWiWMohfx5lT0d-ldpU8QmK_nZS9NznsBzF8G0n-_EwdW78/w400-h188/AG.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;"><b>Allow Firewall</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1fJOq-owIW_UhpeKzXccKp9DMdKADoQZ2nLGL4a4Pe_bicV9MBrr-VEdBCc_sJ_CqeIO2VbDdxVcIc2VbVJeA0ZnmdHp6KYIKmTn5z6D30HCUwQJOMYQ-jn95v7WMaN_F0tFQTyyssn8/s678/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="678" data-original-width="628" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1fJOq-owIW_UhpeKzXccKp9DMdKADoQZ2nLGL4a4Pe_bicV9MBrr-VEdBCc_sJ_CqeIO2VbDdxVcIc2VbVJeA0ZnmdHp6KYIKmTn5z6D30HCUwQJOMYQ-jn95v7WMaN_F0tFQTyyssn8/w592-h640/AG.png" width="592" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><b>Connection Success</b></div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw6R66JU6_Z6tJDIRQVDN7TtG3eUmVc6qk1gal24h7PgmcHjeNFc9fan9MUAsFPSNgJ86JirlQO2BgjHpqBaFNlAGcPxwPDg3vR2GiEmV_VWeMvKTZYL6IZLsCjpa04BoBjOYVjplAynU/s709/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="386" data-original-width="709" height="217" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw6R66JU6_Z6tJDIRQVDN7TtG3eUmVc6qk1gal24h7PgmcHjeNFc9fan9MUAsFPSNgJ86JirlQO2BgjHpqBaFNlAGcPxwPDg3vR2GiEmV_VWeMvKTZYL6IZLsCjpa04BoBjOYVjplAynU/w400-h217/AG.png" width="400" /></a></div><br /><b><br /></b></div><br /><b>Change COnnection string in the application and run the below commands(code first) to generate tables</b></div><br /><b><br /></b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk-ZsjGi1LYYshkxIAISLqpGcaeKhGPjTlOmLNaa8LAEH-t1-a2AaMNjS42Te1bSU3cvNU2Yj5Z24MTSuGbH52To9hEov6zYI7T0yVASAvQLrukvLDEsq7kDBu2RFkqOsPX9L6q_9IGGw/s455/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="254" data-original-width="455" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk-ZsjGi1LYYshkxIAISLqpGcaeKhGPjTlOmLNaa8LAEH-t1-a2AaMNjS42Te1bSU3cvNU2Yj5Z24MTSuGbH52To9hEov6zYI7T0yVASAvQLrukvLDEsq7kDBu2RFkqOsPX9L6q_9IGGw/w400-h224/AG.png" width="400" /></a></div><br /><br /><b>Add the IP address of the VM where the application is running</b></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVsqXkV67ITARO45UtUX2KQ1bJgtY0RgQTAWtraOStQlkAgR0SMH6g3jb2xkR3Am1zPjp297mizcCeVRPeNtEXm48VSb7fTgvsoMvlQJq3fTZThBNBpbQWC9rsrWe0ilSubzQkq8z19OE/s841/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="747" data-original-width="841" height="355" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVsqXkV67ITARO45UtUX2KQ1bJgtY0RgQTAWtraOStQlkAgR0SMH6g3jb2xkR3Am1zPjp297mizcCeVRPeNtEXm48VSb7fTgvsoMvlQJq3fTZThBNBpbQWC9rsrWe0ilSubzQkq8z19OE/w400-h355/AG.png" width="400" /></a></div><br /><b><br /></b></div><br /><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-80854669652014435432021-05-01T15:48:00.000+05:302021-05-01T15:48:32.668+05:30My Azure Study Note - 10 - SQL<p><b> AZ SQL Flavours</b></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw4tEl7mmKgpLqVPa249cerDQqyWHKfOdeqgBY3xtE_ptc1q1K-8fNbMLqI0p2ax6sehvVnCXlnJtpVA5tQBJAtYlLRoWlxvxdT92riKDHSfTlv8jCtc_Wx9am38CbzK-PFk-JGX1vjo8/s643/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="426" data-original-width="643" height="265" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw4tEl7mmKgpLqVPa249cerDQqyWHKfOdeqgBY3xtE_ptc1q1K-8fNbMLqI0p2ax6sehvVnCXlnJtpVA5tQBJAtYlLRoWlxvxdT92riKDHSfTlv8jCtc_Wx9am38CbzK-PFk-JGX1vjo8/w400-h265/AG.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhBW9XqqlHJ5__N0-ZaPyRYvkxBcuigQ8ZzpW8SJ-YVV0icBZz-T8nmxJoR9ru08wYUBVnfxNhZuJl81v6sm74wiH_fxUMVuPJwl8Ck8Z9Slq8vaWLHOwKOIU9zTnFF-jANO4jtBob07Y/s800/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="402" data-original-width="800" height="322" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhBW9XqqlHJ5__N0-ZaPyRYvkxBcuigQ8ZzpW8SJ-YVV0icBZz-T8nmxJoR9ru08wYUBVnfxNhZuJl81v6sm74wiH_fxUMVuPJwl8Ck8Z9Slq8vaWLHOwKOIU9zTnFF-jANO4jtBob07Y/w640-h322/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><b><br /></b><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-13758185361253207192021-05-01T03:33:00.006+05:302021-05-01T04:05:51.253+05:30My Azure Study Note - 12 - Configure Application Gateway<p></p><div class="separator" style="clear: both; text-align: left;"><b>Create Application Gateway</b></div><div class="separator" style="clear: both; text-align: left;"><b><br /></b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUshfKF4XJRS7E8Sq9o3_YxW6nW3BakdBGS1oJ0ssY_IS_gkU3dFtsf5_pkzgi6VmMrLmCM7W83gE8UNSfah8GVf-ioQMjRKVzrb77X-qenKUBasves5BSdC_7t3O52W-oNnp2jHsuQdw/s1911/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="919" data-original-width="1911" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUshfKF4XJRS7E8Sq9o3_YxW6nW3BakdBGS1oJ0ssY_IS_gkU3dFtsf5_pkzgi6VmMrLmCM7W83gE8UNSfah8GVf-ioQMjRKVzrb77X-qenKUBasves5BSdC_7t3O52W-oNnp2jHsuQdw/w640-h308/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: left;"><b><br /></b></div><div class="separator" style="clear: both; text-align: left;"><b>Create Frontends IP</b></div><div class="separator" style="clear: both; text-align: left;"><b><br /></b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPd01SWeDzZuYwHLVokDoSexuhDF0e-eX4r7-TiqcA3eKtv3Krj7QmPCKNZF4yBGiL-rmBJKX1rkeJ2CXTDW3ZU1EwqhYz5bBCM_nweukLL6Xg_S_re2XXsdw0GcD95d1cdDwwvPzu5IE/s448/AGNW.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="355" data-original-width="448" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPd01SWeDzZuYwHLVokDoSexuhDF0e-eX4r7-TiqcA3eKtv3Krj7QmPCKNZF4yBGiL-rmBJKX1rkeJ2CXTDW3ZU1EwqhYz5bBCM_nweukLL6Xg_S_re2XXsdw0GcD95d1cdDwwvPzu5IE/w400-h318/AGNW.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: left;"><b>Create Back end pools</b></div><div class="separator" style="clear: both; text-align: left;"><b><br /></b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbD7F__fzCV5_Znzd3lgkMVr8td73_h9zKIQG522-65fE7-W_oHNoqoZGhlmNGf1SnHYgVDB8tQFNLK5TqlBu27OoUYy4p01ZCQb99aSxQgGCb8e_JDuLqwcI0SORwG4GZWAEWraDfE8w/s1874/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="353" data-original-width="1874" height="120" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbD7F__fzCV5_Znzd3lgkMVr8td73_h9zKIQG522-65fE7-W_oHNoqoZGhlmNGf1SnHYgVDB8tQFNLK5TqlBu27OoUYy4p01ZCQb99aSxQgGCb8e_JDuLqwcI0SORwG4GZWAEWraDfE8w/w640-h120/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">The VM exist in different VNET, hence not being displayed until Vnet Peering</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF56-0N5w_s-PvOAQ-eyfHuhURksyUWzhr_x7LIZ_KHuju7IRYo0Yy122hT3P47dsTZ0wE6ulT-CqLS9HA0O3znWKW8BFWw_raWJJQoyksRNiGobYmE9jPjk6tXVMTP90eCbG3cgVHwoU/s1880/AGNW.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="385" data-original-width="1880" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF56-0N5w_s-PvOAQ-eyfHuhURksyUWzhr_x7LIZ_KHuju7IRYo0Yy122hT3P47dsTZ0wE6ulT-CqLS9HA0O3znWKW8BFWw_raWJJQoyksRNiGobYmE9jPjk6tXVMTP90eCbG3cgVHwoU/w640-h133/AGNW.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;">Hence, choose BE Pool without Target</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBUG-dq1Lj13UzlYpdYFXN6rbd7XkFl44IQwd_mWCCJIC-yXk-upSqRHwgwjz1Jf3CJL06NYCH3dv9uhbqCa6LjTEzGGyY_S6V-8umIppjl8uqzLgzAkeY0EmPRk-NrAcmFX-2uTxtS-0/s1884/AGNW.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="304" data-original-width="1884" height="104" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBUG-dq1Lj13UzlYpdYFXN6rbd7XkFl44IQwd_mWCCJIC-yXk-upSqRHwgwjz1Jf3CJL06NYCH3dv9uhbqCa6LjTEzGGyY_S6V-8umIppjl8uqzLgzAkeY0EmPRk-NrAcmFX-2uTxtS-0/w640-h104/AGNW.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div><b>Create routing rule</b><p></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheWK9zFIZIlhZaRZysWF5NlyGfNzBkdfxFpm-QvkbhquR-iNpg3Mva30SBEzE6PgXd_8PytfAShKKOPw_0nfTczywKuhCDwcCXF4VDK5jOsoPzrNtOes2KPACGUs0sn2MMXHF5F6kaATs/s1562/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="511" data-original-width="1562" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheWK9zFIZIlhZaRZysWF5NlyGfNzBkdfxFpm-QvkbhquR-iNpg3Mva30SBEzE6PgXd_8PytfAShKKOPw_0nfTczywKuhCDwcCXF4VDK5jOsoPzrNtOes2KPACGUs0sn2MMXHF5F6kaATs/w640-h210/AG.png" width="640" /></a></div><br />Backed Targets for the routing rule above<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcT1Ef2GdHVlXgDidzvQSuU757Q2TzG7ArHP7CPpt8ymdfvLfkbRfErinND2f6RdbiXjZEPlOKZFx_oKS-sjh3Dg8yjJ0unNs07bODTCn33Mtgiood4tCQB3BWDvePtmSJUCL7BIk58zU/s1573/AGNW.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="626" data-original-width="1573" height="254" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcT1Ef2GdHVlXgDidzvQSuU757Q2TzG7ArHP7CPpt8ymdfvLfkbRfErinND2f6RdbiXjZEPlOKZFx_oKS-sjh3Dg8yjJ0unNs07bODTCn33Mtgiood4tCQB3BWDvePtmSJUCL7BIk58zU/w640-h254/AGNW.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFcx-hxCGPF3JmvRDW3u9GeQlqot_NF3qmIfJn2R72QqfeEHsL8cXBNkOFEWBwO76l6K5fBJs1JAtlA9PBWsKy2p4lIwzzb-J4YDZlIk0FnwyOtlzrflw5X9eFbsE8XtUuJ7jj2GFKAKE/s1766/AGNW.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="687" data-original-width="1766" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFcx-hxCGPF3JmvRDW3u9GeQlqot_NF3qmIfJn2R72QqfeEHsL8cXBNkOFEWBwO76l6K5fBJs1JAtlA9PBWsKy2p4lIwzzb-J4YDZlIk0FnwyOtlzrflw5X9eFbsE8XtUuJ7jj2GFKAKE/w640-h248/AGNW.png" width="640" /></a></div><br /><p><b>Add Next Routing Rule</b></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhokmHkhbEUQ7nbRukuIE-r-lzgZSlNdKCb1EyevHYUxW2Tpg3kbk7W2bcDJngPYKBPtJVS36BjsMrmPm99hGMOyrVYpHhYTnofBuO_eh8VYt1nPHcy83j5tjICGI2O5J7FwEr6hy0bXP8/s1542/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="513" data-original-width="1542" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhokmHkhbEUQ7nbRukuIE-r-lzgZSlNdKCb1EyevHYUxW2Tpg3kbk7W2bcDJngPYKBPtJVS36BjsMrmPm99hGMOyrVYpHhYTnofBuO_eh8VYt1nPHcy83j5tjICGI2O5J7FwEr6hy0bXP8/w640-h212/AG.png" width="640" /></a></div><br />Add new Backend Target<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkfyvW-VizWXtybf6IM_AMh_lxF2Aa_zkP4z-ZI2BN9FV7ruC6fo2kI84U_YF5Jiu46UHSOsiCC7XLKTx_o4hoyw9S7W0zIWc2144PNWl8A9qI_e4DhLZzFhcd4U5L5C2kw2N5li307Hs/s1920/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkfyvW-VizWXtybf6IM_AMh_lxF2Aa_zkP4z-ZI2BN9FV7ruC6fo2kI84U_YF5Jiu46UHSOsiCC7XLKTx_o4hoyw9S7W0zIWc2144PNWl8A9qI_e4DhLZzFhcd4U5L5C2kw2N5li307Hs/w640-h360/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhp54FDX2xUHYo6R17p-OYO5MYQCQkRTraRLrlHoUDEj3ZRmscPKd_63ixcufadjKXHOe__hH6ax5lMb87Ouvm8FzE6hMWRrXNS6LtiO9aKEFGRfaGl5L4Sqx_KNJcvwYp2bgQm5zHFvuk/s1130/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="431" data-original-width="1130" height="244" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhp54FDX2xUHYo6R17p-OYO5MYQCQkRTraRLrlHoUDEj3ZRmscPKd_63ixcufadjKXHOe__hH6ax5lMb87Ouvm8FzE6hMWRrXNS6LtiO9aKEFGRfaGl5L4Sqx_KNJcvwYp2bgQm5zHFvuk/w640-h244/AG.png" width="640" /></a></div><br /><p><b>Connecting App Service to App gateway</b></p><p>Check backend health</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRQ5SDkiwvjdTOPqE6xk2yzC7REX3OZXLskA8pq-hZpkqM2H8LMptkT1pO1RU4J1lMXNrT7phJvw1x5AkgvqySDCr1xUtyXKMELzCk3tKm8Y1TCobe9529WRAZV-M4v-LqBaawS91gWwo/s1920/AG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRQ5SDkiwvjdTOPqE6xk2yzC7REX3OZXLskA8pq-hZpkqM2H8LMptkT1pO1RU4J1lMXNrT7phJvw1x5AkgvqySDCr1xUtyXKMELzCk3tKm8Y1TCobe9529WRAZV-M4v-LqBaawS91gWwo/w640-h360/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;">App Service has its own host name. Hence, choose the following options</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc74uQ6xIhga1Qn6zIDCpA1titaYEW1ux58c5C_BrdL6K51qWbJQrEVnWIcrTUjC-utfyTEcM34OaNrD2UuyNrtuX02Ve8kYv7GWDuqrvtZ5U9DjZTCUhisU8IcpXYavCwBxuQcfWgewY/s1399/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="795" data-original-width="1399" height="364" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc74uQ6xIhga1Qn6zIDCpA1titaYEW1ux58c5C_BrdL6K51qWbJQrEVnWIcrTUjC-utfyTEcM34OaNrD2UuyNrtuX02Ve8kYv7GWDuqrvtZ5U9DjZTCUhisU8IcpXYavCwBxuQcfWgewY/w640-h364/AG.png" width="640" /></a></div><div><br /></div>Check backend health once again<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdUYsFhw0KPSuOI3QsKXq4Uk_E5Nt9VNHhMYFfPYPQDgtYJrmACfyiJK976WYvtkrPi-9fp0ZrDvn1v3Sm_xaYYIcheFQJj9RaxFu4obB9WkezYQNjIb6SoX6Vfa3gvlibHdv33SROX6Q/s1677/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="732" data-original-width="1677" height="280" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdUYsFhw0KPSuOI3QsKXq4Uk_E5Nt9VNHhMYFfPYPQDgtYJrmACfyiJK976WYvtkrPi-9fp0ZrDvn1v3Sm_xaYYIcheFQJj9RaxFu4obB9WkezYQNjIb6SoX6Vfa3gvlibHdv33SROX6Q/w640-h280/AG.png" width="640" /></a></div><br /><div><br /><p>Try frontend IP of the application gateway in the browser and the target app service should be run(on the default port 80)</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8OQS0KJiKQDeVp_yMrZCvp8qByC1-Cn3HX0wgRwpBEUEGwGE78fkpGlU_nEhwpVlaGkXwK05Zj6z-ueFMUKHqmKEvdqLMGJsvDME88alhUTJmRu3ElugSuYsRHV5GmKESQzN3p7mkGW0/s1668/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="446" data-original-width="1668" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8OQS0KJiKQDeVp_yMrZCvp8qByC1-Cn3HX0wgRwpBEUEGwGE78fkpGlU_nEhwpVlaGkXwK05Zj6z-ueFMUKHqmKEvdqLMGJsvDME88alhUTJmRu3ElugSuYsRHV5GmKESQzN3p7mkGW0/w640-h173/AG.png" width="640" /></a></div><br /><p>Create service endpoint in the event between app service and app gateway subnet so that app service only receive traffic from app gateway subnet</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0iaKz7fWif6CrZcaEtqhBZdImzOwKfyVtq5PvGJef6QYkhs9wFaYJGvRo69WF_HOiQTpVObK91ThUiw65-cJ72MWGRtJQ3u5NBK7PYPLyZjcCoLHsjenom31xbKnMiGYvdmEedggA5iY/s1743/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="673" data-original-width="1743" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0iaKz7fWif6CrZcaEtqhBZdImzOwKfyVtq5PvGJef6QYkhs9wFaYJGvRo69WF_HOiQTpVObK91ThUiw65-cJ72MWGRtJQ3u5NBK7PYPLyZjcCoLHsjenom31xbKnMiGYvdmEedggA5iY/w640-h248/AG.png" width="640" /></a></div><br /> <p></p><div class="separator" style="clear: both; text-align: left;">Add that service endpoint to the app service</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GVrhwUSsQUzKk8vrK-vojNBhCCCV3fVVUL9lUITnvn1fv4x-NyjaC_GEljRWhvXeucHtoATP3Dg0eLwEW7404rvw3j4gEKPAaVaznsL3xi9AG7iTBt7P3zYFP5Yr0OwDPOh9JI4qxZM/s1064/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="812" data-original-width="1064" height="488" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GVrhwUSsQUzKk8vrK-vojNBhCCCV3fVVUL9lUITnvn1fv4x-NyjaC_GEljRWhvXeucHtoATP3Dg0eLwEW7404rvw3j4gEKPAaVaznsL3xi9AG7iTBt7P3zYFP5Yr0OwDPOh9JI4qxZM/w640-h488/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div>Allow the Vnet and the subnet of the App Gateway</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVznJRIXn99rBKqCXhzx8RQhjCFt0C3rUJHHAI6Z0qLDAdSXtUvDmos8YRKpvIBByykjGsPlwQur3VUF46nOEqJmgQgMRDLLKx1XOfWhxdkqXYxCBRvylbK9z1wJ5gor6vECeBO0ublZo/s1886/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="608" data-original-width="1886" height="206" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVznJRIXn99rBKqCXhzx8RQhjCFt0C3rUJHHAI6Z0qLDAdSXtUvDmos8YRKpvIBByykjGsPlwQur3VUF46nOEqJmgQgMRDLLKx1XOfWhxdkqXYxCBRvylbK9z1wJ5gor6vECeBO0ublZo/w640-h206/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbEJ4_49gFEIEdIUSZ4nT2porxZ5lQpsV76RAKK0pMF6DRBrUfmfwNutMTMKl_QbQBfPUlHlqQjhDD1O8-YAgfR5jCGnAZsFQZHNK-BGtU0qb-gaAtdeQuvuUWXK3QiufgX8XYJi02tiE/s1610/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="453" data-original-width="1610" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbEJ4_49gFEIEdIUSZ4nT2porxZ5lQpsV76RAKK0pMF6DRBrUfmfwNutMTMKl_QbQBfPUlHlqQjhDD1O8-YAgfR5jCGnAZsFQZHNK-BGtU0qb-gaAtdeQuvuUWXK3QiufgX8XYJi02tiE/w640-h180/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;">Now the access is forbidden for the direct access of app service</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6O3HFD21AnVhHq-g0_fCXvAJZukE6hN-s8o1E9kAl-JIwaZSvLFBxhJWRlDZpUqLzZTWQ_O3MiuxeT6WGKsIfqJx3T7aSNEodHItTQQHpRD0ZW6JBthI-Zk_4N6E_-N8KxtOJEAcTifY/s1855/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="444" data-original-width="1855" height="154" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6O3HFD21AnVhHq-g0_fCXvAJZukE6hN-s8o1E9kAl-JIwaZSvLFBxhJWRlDZpUqLzZTWQ_O3MiuxeT6WGKsIfqJx3T7aSNEodHItTQQHpRD0ZW6JBthI-Zk_4N6E_-N8KxtOJEAcTifY/w640-h154/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGnMSw8wl45ZCKqaKqBIW5-MziS4Lrpb-gqWqlQYaDmkfyzH7Lggru00fwKfSI_CTUOHOG74F7QK7KSLeEihgWUKf2-oKrvLdW2nV5BusI97or_zmioLLK_SWlGZeMxBu0SDzpPAwnGPE/s632/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="282" data-original-width="632" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGnMSw8wl45ZCKqaKqBIW5-MziS4Lrpb-gqWqlQYaDmkfyzH7Lggru00fwKfSI_CTUOHOG74F7QK7KSLeEihgWUKf2-oKrvLdW2nV5BusI97or_zmioLLK_SWlGZeMxBu0SDzpPAwnGPE/w640-h286/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><b>Configure Access of catalog VM</b><div>Catalog VM exist in different VNET, so peering is required</div><div><br /></div><div>Go to the VNet of the catalog VM</div><div>Add a peering</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPagQVCRQOCTc8knwKnMjux0GUG8IqQxQZK8SAVqtTnOW4Q8ZY37PUCaZz6abLVmjlrOgAXMDp1AQVUSJ0IjS51wA0qd-G4NuWAtY1sR6Yt_PXCmV1PIFwmxj6ZUSNcXqBSzlp8ErQ-iY/s695/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="633" data-original-width="695" height="582" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPagQVCRQOCTc8knwKnMjux0GUG8IqQxQZK8SAVqtTnOW4Q8ZY37PUCaZz6abLVmjlrOgAXMDp1AQVUSJ0IjS51wA0qd-G4NuWAtY1sR6Yt_PXCmV1PIFwmxj6ZUSNcXqBSzlp8ErQ-iY/w640-h582/AG.png" width="640" /></a></div><br /><div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY8DP18SVbs-b4Nr2YeuNZVZOliCny4_qyRn-ewiqDAeSQbvtddlMKeXUzP9aNzW7m5fj_871We3RTm03yn_4Sj3-58gwI6_j9GpUhsnMLcb6nVrexhiuPo1d7lzqNW81tlWSiXaMjeDw/s767/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="690" data-original-width="767" height="576" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY8DP18SVbs-b4Nr2YeuNZVZOliCny4_qyRn-ewiqDAeSQbvtddlMKeXUzP9aNzW7m5fj_871We3RTm03yn_4Sj3-58gwI6_j9GpUhsnMLcb6nVrexhiuPo1d7lzqNW81tlWSiXaMjeDw/w640-h576/AG.png" width="640" /></a></div><br /><div>Go to the Application Gateway Catalog Pool</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK9j2wgYNTyVJ1LqQ2-6crwe2EWby_dAwa5VeJ-yTVBYq8HUo7_SFSBbO4jgjap7xm0fVgM7TouqJs7_ZHcvsT6NYpT7hZBvZ4VrGsPyUhBTglTLqzFTsWUytde3a1V5MF4cycXxdtxvU/s1051/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="441" data-original-width="1051" height="268" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK9j2wgYNTyVJ1LqQ2-6crwe2EWby_dAwa5VeJ-yTVBYq8HUo7_SFSBbO4jgjap7xm0fVgM7TouqJs7_ZHcvsT6NYpT7hZBvZ4VrGsPyUhBTglTLqzFTsWUytde3a1V5MF4cycXxdtxvU/w640-h268/AG.png" width="640" /></a></div><br /><div>Enter the Private IP address of Catalog VM</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCQwseG-d4ZeEylRA2yU_aj01mAFN-N8VQQBEWOPnRL1DiaI0BKK5bEWMl-OuLSKltMrwHUH7iCGTzNcxoN_uogFiPSwSLf1cUi9kUKMeDoV5yVd4MahT_MMn1JuhodPV6L3slbXO-dMk/s403/AGNW.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="326" data-original-width="403" height="518" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCQwseG-d4ZeEylRA2yU_aj01mAFN-N8VQQBEWOPnRL1DiaI0BKK5bEWMl-OuLSKltMrwHUH7iCGTzNcxoN_uogFiPSwSLf1cUi9kUKMeDoV5yVd4MahT_MMn1JuhodPV6L3slbXO-dMk/w640-h518/AGNW.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div>Check Backend health</div><div>Delete Port 8080 to restrict the direct access of catalog VM</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi1wmxa5Cgo1UMmWRZ-zW6iiUS_lgh1xO3V2UJweVof2hz4Y69jxH-aDakWbBP95Em0rcIZDsLtw5Pw2GvvH3NMtaUHFMUuHZ_y5LJOJE6IlYUs3TQUXwvCzhSxaw49hNeSsJUF6bVJ84/s1862/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="592" data-original-width="1862" height="204" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi1wmxa5Cgo1UMmWRZ-zW6iiUS_lgh1xO3V2UJweVof2hz4Y69jxH-aDakWbBP95Em0rcIZDsLtw5Pw2GvvH3NMtaUHFMUuHZ_y5LJOJE6IlYUs3TQUXwvCzhSxaw49hNeSsJUF6bVJ84/w640-h204/AG.png" width="640" /></a></div><br /><div>Try the App Gateway IP with port</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixyo6bEHGxj6TjcMgG__HPvtP0EVbeDfuW6QlZuTdOIzSnQ9pUxi9sj7kvCCSFO48vMl7ohE34BmS4IJRCwYgBEEhklAkguaB-P4K_mZ5_2j0vaa8wxlZbbh4JTtOVwfptTYTqWnrX26M/s1383/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="1383" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixyo6bEHGxj6TjcMgG__HPvtP0EVbeDfuW6QlZuTdOIzSnQ9pUxi9sj7kvCCSFO48vMl7ohE34BmS4IJRCwYgBEEhklAkguaB-P4K_mZ5_2j0vaa8wxlZbbh4JTtOVwfptTYTqWnrX26M/w640-h232/AG.png" width="640" /></a></div><br /><div><br /><div><br /> <p></p></div></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-40768872008530266742021-05-01T03:03:00.003+05:302021-05-01T03:03:30.742+05:30My Azure Study Note - 11 - Application Gateway<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1J15m0DmcBsUTW_dfQTZyUjKt3OYHVrZZBTByUWerIK9xJ3xRcVrkJ6-xC2AepWQUSbkzcyrgF3N6Ks0KG7g7TrRjfzeWkRIbcKDTwZFPEwJ-uI3U0CDJH2sbSGhsPW3BEaucZyHd0o0/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1J15m0DmcBsUTW_dfQTZyUjKt3OYHVrZZBTByUWerIK9xJ3xRcVrkJ6-xC2AepWQUSbkzcyrgF3N6Ks0KG7g7TrRjfzeWkRIbcKDTwZFPEwJ-uI3U0CDJH2sbSGhsPW3BEaucZyHd0o0/w640-h360/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZfns83spGeOI-yJYY-Z0Wa35vK9M4lCkjFGv5H80OtKnzbR231wKYoYcbKtCzXcBUhzSACudpuYDMr783PXKy2L4_goFrIEGyLbV6Ert6kO2hYwyTwxrMZcmuJOIVnN05jzAdygvwvH0/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZfns83spGeOI-yJYY-Z0Wa35vK9M4lCkjFGv5H80OtKnzbR231wKYoYcbKtCzXcBUhzSACudpuYDMr783PXKy2L4_goFrIEGyLbV6Ert6kO2hYwyTwxrMZcmuJOIVnN05jzAdygvwvH0/w640-h360/AG.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRa0iURaWwi10p8KWe5uqLBTA8n8RMlo4zgso6c0oxj__z5Ril-ReLdOglDyVp-u_o5cWoXuetzhg3G5WkfBMAh9f-ud6lCJZBNE8Vgg7-qeHAA8ERKXFvjDfhC7OMTqsLZL2QpGYej5I/s884/AGNW.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="558" data-original-width="884" height="404" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRa0iURaWwi10p8KWe5uqLBTA8n8RMlo4zgso6c0oxj__z5Ril-ReLdOglDyVp-u_o5cWoXuetzhg3G5WkfBMAh9f-ud6lCJZBNE8Vgg7-qeHAA8ERKXFvjDfhC7OMTqsLZL2QpGYej5I/w640-h404/AGNW.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipFSRHpS5sfoNsNVnGBl4E52vB_hiLSgei2bKYuMaG2p_i-2Q67_xyVxKoDYEoUvdhvTJGnG_uMNQEMkek90yrgWPNPg7mUCxdFWQXTW4c_N5PIGitbeKRp8OersDsWTt3u0mPwKpRbUQ/s586/AGNW.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="453" data-original-width="586" height="309" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipFSRHpS5sfoNsNVnGBl4E52vB_hiLSgei2bKYuMaG2p_i-2Q67_xyVxKoDYEoUvdhvTJGnG_uMNQEMkek90yrgWPNPg7mUCxdFWQXTW4c_N5PIGitbeKRp8OersDsWTt3u0mPwKpRbUQ/w400-h309/AGNW.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxrY9Lp364b3mYjesMU8EDlPqEygxX4edlNRUWKde6oOOYVU_deOt7-SeJRegwF3M0Vf6mrrYPKhEaQUD1yUGUWFM15_WTovzDhcA96lu97HESkoENV6tCIXCZP28FpbvJ4L6sclmeyu0/s1920/AG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxrY9Lp364b3mYjesMU8EDlPqEygxX4edlNRUWKde6oOOYVU_deOt7-SeJRegwF3M0Vf6mrrYPKhEaQUD1yUGUWFM15_WTovzDhcA96lu97HESkoENV6tCIXCZP28FpbvJ4L6sclmeyu0/w640-h360/AG.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br />Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-20113928278539786862021-05-01T02:49:00.000+05:302021-05-01T02:49:05.481+05:30My Azure Study Note - 10 - Load Balancer<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhac2MSNVoFaZ4IBmznUflfP9p5gHas1KYnalodkBI9qLYO8mkJJFmtIGCLjm-l_8vNrlHRxaU-pw8p3mc-d5mrZalW6fj7QLR9lLGsNXyT3mu-ymSQGOLPCdIRfx2KlI0Hooary2TQ4tE/s1920/LB.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhac2MSNVoFaZ4IBmznUflfP9p5gHas1KYnalodkBI9qLYO8mkJJFmtIGCLjm-l_8vNrlHRxaU-pw8p3mc-d5mrZalW6fj7QLR9lLGsNXyT3mu-ymSQGOLPCdIRfx2KlI0Hooary2TQ4tE/w640-h360/LB.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHph6FrGPhzfKKNrNbQ3aYV5jmjuPCm-oxopuPwktTBg6YunCkdz9RjS2d-PX2vz_6XUfrWOkLtjGgmXEdg70vAO4lz75NbF24N_P3lLyah7BQTskDmXGsVYcybm_jn_xNJyqKwzPkBig/s695/OSI.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="431" data-original-width="695" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHph6FrGPhzfKKNrNbQ3aYV5jmjuPCm-oxopuPwktTBg6YunCkdz9RjS2d-PX2vz_6XUfrWOkLtjGgmXEdg70vAO4lz75NbF24N_P3lLyah7BQTskDmXGsVYcybm_jn_xNJyqKwzPkBig/w400-h248/OSI.PNG" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgu7-biP_tr0BqoBgzGrTFNP_KzRT2y83d_MtoddXUoqzJDmc5VUFthHOJ_1LrfYPGoDHmBHiQqg8QH51QUchrn0Olq0GMqjDH6bs1RI-4mBBJznR4h1t8bh51wknrGI01NwijbI-OdU0/s1920/LBType.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgu7-biP_tr0BqoBgzGrTFNP_KzRT2y83d_MtoddXUoqzJDmc5VUFthHOJ_1LrfYPGoDHmBHiQqg8QH51QUchrn0Olq0GMqjDH6bs1RI-4mBBJznR4h1t8bh51wknrGI01NwijbI-OdU0/w400-h225/LBType.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4PzRVm1M65jZ1XBuLIxdsgA4tOpg2MI7C6xC_EbfTdxyjMBy9SltpA9RxtXURtxOJEweo9k0fCQUCFNUvRabK5CfgsJeX7KijlEO9B0c5ApPPsBrKA0hkGnFu7f5Fg9OxTEXki53YtaM/s1920/LBCOnfig.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4PzRVm1M65jZ1XBuLIxdsgA4tOpg2MI7C6xC_EbfTdxyjMBy9SltpA9RxtXURtxOJEweo9k0fCQUCFNUvRabK5CfgsJeX7KijlEO9B0c5ApPPsBrKA0hkGnFu7f5Fg9OxTEXki53YtaM/w400-h225/LBCOnfig.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiixQyTttc9Yopwp9wIf8qBJ3wnWeZoDUEddvW2b0yA1JLeJC-X11mitlnKFWVDYzg89SBmAUW55IoBjwMiuDPMykF0LVmqR1dDrZqLksiGYpuJKiwJHbkIlfcHy3syp7BtnREo_bbwEsI/s1920/LBHP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiixQyTttc9Yopwp9wIf8qBJ3wnWeZoDUEddvW2b0yA1JLeJC-X11mitlnKFWVDYzg89SBmAUW55IoBjwMiuDPMykF0LVmqR1dDrZqLksiGYpuJKiwJHbkIlfcHy3syp7BtnREo_bbwEsI/w400-h225/LBHP.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkVBAA-Zx23bYP15n54x-F1PFG5N0APjupMX0vbLcLy0CZKusBtzVBwB8sVNrsUInMCIGXc3Rd8UyUQ_ITDAWCp0e7zF7iwQlH060DCOnUc3GOPQDxFE1Wf0t3m89BRKG2vEi_owxZCag/s1920/LBHP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkVBAA-Zx23bYP15n54x-F1PFG5N0APjupMX0vbLcLy0CZKusBtzVBwB8sVNrsUInMCIGXc3Rd8UyUQ_ITDAWCp0e7zF7iwQlH060DCOnUc3GOPQDxFE1Wf0t3m89BRKG2vEi_owxZCag/w400-h225/LBHP.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><br /><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-57517696001780504272021-04-30T01:26:00.006+05:302021-04-30T14:22:00.596+05:30My Azure Study Note - 09 - Secure VM Access, Service Endpoint, Private Link, ASE<p><b> Secure VM Access</b></p><p><b></b></p><div class="separator" style="clear: both; text-align: center;"><b><br /></b></div><b><br /><br /></b><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBR2VgmofvzLeX9klIoOncI5WflgN_TbTAVcHv8J9uAuS_8enQKPOnbOvbZuQH0Q47zinQ5qognuuItzN9yaQ5O9rB-YSGtpkmdGAMC0CBazU2xInhJXTKm5XG6qb0_rNxDNGyMqZAunE/s629/SecureVM.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="483" data-original-width="629" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBR2VgmofvzLeX9klIoOncI5WflgN_TbTAVcHv8J9uAuS_8enQKPOnbOvbZuQH0Q47zinQ5qognuuItzN9yaQ5O9rB-YSGtpkmdGAMC0CBazU2xInhJXTKm5XG6qb0_rNxDNGyMqZAunE/s320/SecureVM.PNG" width="320" /></a></div><br /><p></p><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><div style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRK6lJeLQ3xLy_ui0npz9c_GbQnMTkR7DYDGagzgpsYR4odtZiVk0PMYZMjOm3CokAIBwTDsjmucIISnx095stdb-EFJQQdENKkbwqGaRUVQTY3T2hk_eVgLf9kOhhyfvQ4COenTyqjbE/s1003/SvcEP.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1003" data-original-width="927" height="291" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRK6lJeLQ3xLy_ui0npz9c_GbQnMTkR7DYDGagzgpsYR4odtZiVk0PMYZMjOm3CokAIBwTDsjmucIISnx095stdb-EFJQQdENKkbwqGaRUVQTY3T2hk_eVgLf9kOhhyfvQ4COenTyqjbE/w269-h291/SvcEP.png" width="269" /></a><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisOd_OdskxifjZFFfSRMh4zDdLKBruGNG6Nl-hBKtQ8yRDmIPhsms52orMoTwsEILwEBeGZDUdYvhMUqhICT3VT0aYqEL1Z3FX-IUJb-z9rt-d91rj4X2z1T_1XIHwFucSSFDsXpozBYk/s1083/PrvLink.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1057" data-original-width="1083" height="303" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisOd_OdskxifjZFFfSRMh4zDdLKBruGNG6Nl-hBKtQ8yRDmIPhsms52orMoTwsEILwEBeGZDUdYvhMUqhICT3VT0aYqEL1Z3FX-IUJb-z9rt-d91rj4X2z1T_1XIHwFucSSFDsXpozBYk/w311-h303/PrvLink.png" width="311" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI-xXrk5XFOtTyf0tSM02n9cXB-XW7v9nCGbleWnynp-I4SRAQFOlE2Ai7kNFTYMycvjXrFYu5VGFoPRenwfKKrxoc78koxTylrIAtGI34M6Syx6lr6oWu9crA5IP_K6Yx0EMfSxKVz5k/s1920/SERes.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI-xXrk5XFOtTyf0tSM02n9cXB-XW7v9nCGbleWnynp-I4SRAQFOlE2Ai7kNFTYMycvjXrFYu5VGFoPRenwfKKrxoc78koxTylrIAtGI34M6Syx6lr6oWu9crA5IP_K6Yx0EMfSxKVz5k/w400-h225/SERes.png" width="400" /></a><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgymygmxPOPmXI4KAnlqu9uF2gbnunCiHthb0qDoG3EcuS6Z3PcxfMOxm6VUzstnbQ0U8tclKEkYC3vlnspQVopCM5DzjffMHoo6Z7Qxz5K182RlpTFLxCAFeFqGQYQgiy96cOT6nJCHNI/s1920/PLResources.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgymygmxPOPmXI4KAnlqu9uF2gbnunCiHthb0qDoG3EcuS6Z3PcxfMOxm6VUzstnbQ0U8tclKEkYC3vlnspQVopCM5DzjffMHoo6Z7Qxz5K182RlpTFLxCAFeFqGQYQgiy96cOT6nJCHNI/w400-h225/PLResources.png" width="400" /></a></div><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div></div></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPmdbty2QLWXRhsDAYMvzaxDJlX4KIvqVBNrWtxInujbqYo-9xi0_-cpLbtkrvdSNra8nzpVQZk4hFq3Nr2wx0kSENrU3fM5JffRLlPggiW9kMaVJJtS534_he4qvDHUhw2ZVqnXOZITo/s1673/Priv.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="609" data-original-width="1673" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPmdbty2QLWXRhsDAYMvzaxDJlX4KIvqVBNrWtxInujbqYo-9xi0_-cpLbtkrvdSNra8nzpVQZk4hFq3Nr2wx0kSENrU3fM5JffRLlPggiW9kMaVJJtS534_he4qvDHUhw2ZVqnXOZITo/w640-h232/Priv.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;"><b><br /></b></div><div class="separator" style="clear: both;"><b>App Svc Env(ASE)</b>- Special type of App Svc deployed directly to a dedicated Vnet. Created on dedicated hardware.</div><div class="separator" style="clear: both;">Normal app svc can't be placed in any Vnet. However, it can have access protection.</div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">For complete isolation, ASE is used. It requires scale up and Isolated.</div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;"><div class="separator" style="clear: both;">ASEs are isolated from running only a single customer’s applications and are always deployed into a virtual network. Customers have fine-grained control over inbound and outbound application network traffic. Applications can establish high-speed secure connections over VPNs to on-premises corporate resources.</div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">Customers can create multiple ASEs within a single Azure region or across multiple Azure regions. This flexibility makes ASEs ideal for horizontally scaling stateless application tiers in support of high RPS workloads. App Service environments (ASEs) are appropriate for application workloads that require:</div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">Very high scale.</div><div class="separator" style="clear: both;">Isolation and secure network access.</div><div class="separator" style="clear: both;">High memory utilization.</div></div></div><br /><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-52596959493807578902021-04-19T08:54:00.008+05:302021-04-19T11:58:48.586+05:30My Azure Study Note - 08 - Azure Function<p><b>What is Azure Function</b></p><p>Azure Functions is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running.</p><p><b>What is Trigger and Binding in azure ?</b></p><p>Triggers are what cause a function to run. A trigger defines how a function is invoked and a function must have exactly one trigger. Triggers have associated data, which is often provided as the payload of the function.</p><p>Binding to a function is a way of declaratively connecting another resource to the function; bindings may be connected as input bindings, output bindings, or both. Data from bindings is provided to the function as parameters.</p><p>You can mix and match different bindings to suit your needs. Bindings are optional and a function might have one or multiple input and/or output bindings.</p><p></p><p>Triggers and bindings let you avoid hardcoding access to other services. Your function receives data (for example, the content of a queue message) in function parameters. You send data (for example, to create a queue message) by using the return value of the function.</p><p>Example- A scheduled job reads Blob Storage contents and creates a new Cosmos DB document.</p><p>Trigger = Timer<span style="white-space: pre;"> </span></p><p>Input binding = Blob Storage<span style="white-space: pre;"> </span></p><p>Output binding = Cosmos DB</p><p>Sample Function</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8CgCY6CXJD2hoY2yr_tYKLncfRKnesxioWdbCKpCyg_cKWR-W_wYgpa7C6qhFdMixgVud7eD2AMluUHOQjs1VjaN5nTu3yqhU5Blcfa7Q7V55M-wzKcD41929KynTmizFRNAeXjCW-po/s1264/Function.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="485" data-original-width="1264" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8CgCY6CXJD2hoY2yr_tYKLncfRKnesxioWdbCKpCyg_cKWR-W_wYgpa7C6qhFdMixgVud7eD2AMluUHOQjs1VjaN5nTu3yqhU5Blcfa7Q7V55M-wzKcD41929KynTmizFRNAeXjCW-po/s16000/Function.png" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6wfA7RfknYiQN4I0sj9BLQc260nBZ6zawzOfQjQYRyu5mIK4uNeULHj6Jw_ifFvnie04AZH_9UGUBJ-dLktjzseZ9HZNEwtHA27aI5Is9rrxFR2Wdzhezk9-w8PyWJ4WF9o3CDGi5I4M/s1816/Trigger.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="725" data-original-width="1816" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6wfA7RfknYiQN4I0sj9BLQc260nBZ6zawzOfQjQYRyu5mIK4uNeULHj6Jw_ifFvnie04AZH_9UGUBJ-dLktjzseZ9HZNEwtHA27aI5Is9rrxFR2Wdzhezk9-w8PyWJ4WF9o3CDGi5I4M/w640-h256/Trigger.png" width="640" /></a></div><br /><p><b>What is Cold Start ?</b></p><p>Cold start is a term used to describe the phenomenon that applications which haven’t been used take longer to start up.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDDhuV5mu0cuBMbuuJcO55f-wJFURAREWeLkp0e4jUa5CpEhszNWGV86qJnBRXa9w-XWppyIiEhvAWVApKYuvv0mKK_OXoWllmWnQRTho4Zpw2ueha47jyg9wucAk6uAsqhXwgwq67PsY/s1024/Cold.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="535" data-original-width="1024" height="334" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDDhuV5mu0cuBMbuuJcO55f-wJFURAREWeLkp0e4jUa5CpEhszNWGV86qJnBRXa9w-XWppyIiEhvAWVApKYuvv0mKK_OXoWllmWnQRTho4Zpw2ueha47jyg9wucAk6uAsqhXwgwq67PsY/w640-h334/Cold.jpeg" width="640" /></a></div><br /><p><b>What is Durable Function</b></p><p>Durable Functions is an extension of Azure Functions and Azure WebJobs that lets you write stateful functions in a serverless environment. The extension manages state, checkpoints, and restarts for you.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj40jf2kznE8LmlfxvM_5kB1JScmnRd836gkA2Q4MJS3pcDCkATINuKLwzzQmpuAMqEHBRQKhJl0WUvfTArT2X52m_RDnyLBs2X43mSOOvMMD1BjNB1zNooMxqZvOmf_GyQYIMq_37JjPs/s847/Durable.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="847" height="226" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj40jf2kznE8LmlfxvM_5kB1JScmnRd836gkA2Q4MJS3pcDCkATINuKLwzzQmpuAMqEHBRQKhJl0WUvfTArT2X52m_RDnyLBs2X43mSOOvMMD1BjNB1zNooMxqZvOmf_GyQYIMq_37JjPs/w400-h226/Durable.png" width="400" /></a></div><p><b>Run Azure Function Locally</b></p><ul style="background-color: white; box-sizing: inherit; color: #171717; font-family: "Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.3; list-style: none; margin: 16px 0px 16px 1rem; outline-color: inherit; padding: 0px;"><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;"><a data-linktype="self-bookmark" href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Ccsharp%2Cbash#v2" style="background-color: transparent; box-sizing: inherit; cursor: pointer; outline-color: inherit; outline-style: initial; outline-width: 0px; overflow-wrap: break-word; text-decoration-line: none;">Install the Core Tools and dependencies.</a></li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;">Download the VS Code Extension - Azure Functions</li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;">Download Postman</li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;">In the terminal run the command- <i>dotnet restore</i></li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;">Initialize and run the code in VS Studio with the extension</li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;"><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmGrlj4S9ET1A_x7yHEeMEzPpc5U5Fx-5vJrbr_rqCGd9P4MuBnYXUFTi7HU3rkg8AKiyUtUiL4AAhyQjOsZYPFzfIWYjpSnAHYi_eexBcWU5EApszyHzwBPE_RAvjd_1Kq_84xzwRwgc/s526/FunctionLocal.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="526" data-original-width="475" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmGrlj4S9ET1A_x7yHEeMEzPpc5U5Fx-5vJrbr_rqCGd9P4MuBnYXUFTi7HU3rkg8AKiyUtUiL4AAhyQjOsZYPFzfIWYjpSnAHYi_eexBcWU5EApszyHzwBPE_RAvjd_1Kq_84xzwRwgc/s320/FunctionLocal.png" /></a></div><br /></li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;"><div class="separator" style="clear: both; text-align: left;">Test the code from Postman</div></li><li style="box-sizing: inherit; list-style: outside none none; margin: 0px 0px 0px 1em; outline-color: inherit; outline-style: initial; outline-width: 0px; padding: 0px; position: relative;"><div class="separator" style="clear: both; text-align: left;"><b style="color: black; font-family: "Times New Roman"; font-size: medium;"><br /></b></div></li></ul><b style="background-color: white;">Run Azure Function in Azure</b><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;">Run Bash command to create storage account</span></div><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;">az storage account create --name <i>readitfuncstorage </i>--location westeurope --resource-group readit-app-rg --sku Standard_LRS</span></div><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;">Create azure function</span></div><div><span style="background-color: white;">az functionapp create --name <i>readitfunctionapp </i>--storage-account readitfunctionstorage --consumption-plan-location westeurope --resource-group readit-app-rg --functions-version 3</span></div><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;">Same command with alternative func name and storage account</span></div><div><span style="background-color: white;">az functionapp create --name readitfunctionapp2 --storage-account readitfuncstorage2 --consumption-plan-location westeurope --resource-group readit-app-rg --functions-version 3</span></div><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;">In Azure, Search the function app in all resources</span></div><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;">Deploy the function app in VS Code</span></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidqksOlOMcpxvk2x_za21DmsVM59fvLdvrrW9uzM78QjIVCwLEXv2eLs6aR9J7Wron7PD6-I5y7bN4gloK9N7OVh8ARgNYJjORCgtU7PSYnVJ26R1gJfHQrMXTVaaZDB20BRukusecZEs/s444/Deploy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="444" data-original-width="332" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidqksOlOMcpxvk2x_za21DmsVM59fvLdvrrW9uzM78QjIVCwLEXv2eLs6aR9J7Wron7PD6-I5y7bN4gloK9N7OVh8ARgNYJjORCgtU7PSYnVJ26R1gJfHQrMXTVaaZDB20BRukusecZEs/s320/Deploy.png" /></a></div><br /><span style="background-color: white;">Check in the azure portal for those new functions<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJayBmkeoU3aGspq8PjoX9sPnHoz2nECUxYWPawiwQq2KbsRGpXkaGPrnKm8LSXPZ0pmNtGulh_utCda0wgVZVc9YeRLhjLnz6zMr19ADUmRW8N2dQJpzLvnlnxWrvVP8i91-vXvymWo4/s1139/Functions.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="464" data-original-width="1139" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJayBmkeoU3aGspq8PjoX9sPnHoz2nECUxYWPawiwQq2KbsRGpXkaGPrnKm8LSXPZ0pmNtGulh_utCda0wgVZVc9YeRLhjLnz6zMr19ADUmRW8N2dQJpzLvnlnxWrvVP8i91-vXvymWo4/w400-h163/Functions.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Click on any function and go to Code+Test. The output will be printed in the log.</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfnJR4JqIRC8KaGjP1EH1BcX_ZGJRc1cUuWPAaGSztdG28fRDmDDG7FiLUeAiQ61H-Ti8ldcg4nwxMzc-5BAfcEaSzsuW7kKQ-WI5m46BSnxyzs402gPvlZBS5RrgHsdn_YcH5QWT1uQQ/s1307/Test.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="560" data-original-width="1307" height="274" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfnJR4JqIRC8KaGjP1EH1BcX_ZGJRc1cUuWPAaGSztdG28fRDmDDG7FiLUeAiQ61H-Ti8ldcg4nwxMzc-5BAfcEaSzsuW7kKQ-WI5m46BSnxyzs402gPvlZBS5RrgHsdn_YcH5QWT1uQQ/w640-h274/Test.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div>Click the GET Function URL and copy the URL to Postman<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjhVfjhIpNC9UfTqZ4SRG07shRShXk-KoFP6hzqEr2ZX8S9u0e_NoaKv2TOu-dHCndxYJqLX9pzOiJducmd_v2XK-1oPMaFyzWE-OBX4s-EVJgPumBpKDd1JYnEpcrcPxZOBQ8hpxX_pI/s765/GetURL.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="347" data-original-width="765" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjhVfjhIpNC9UfTqZ4SRG07shRShXk-KoFP6hzqEr2ZX8S9u0e_NoaKv2TOu-dHCndxYJqLX9pzOiJducmd_v2XK-1oPMaFyzWE-OBX4s-EVJgPumBpKDd1JYnEpcrcPxZOBQ8hpxX_pI/w400-h181/GetURL.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Clear the console window in Azure</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Test the function from Postman and check the log once again</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2bPNnBIkEtZrOuzM90_92oJDww9Z9C8s9bk4_vz6rW5i-QyfkEJnE7qHcmi5tXoH1Y1D0ozQUi0GywQz6R1UV-d6lgEUqrahr4iyhsExNXfOpSPvr2kKJ8DHPHImFpLuBPjl1DE2QPbw/s715/PostMan.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="408" data-original-width="715" height="229" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2bPNnBIkEtZrOuzM90_92oJDww9Z9C8s9bk4_vz6rW5i-QyfkEJnE7qHcmi5tXoH1Y1D0ozQUi0GywQz6R1UV-d6lgEUqrahr4iyhsExNXfOpSPvr2kKJ8DHPHImFpLuBPjl1DE2QPbw/w400-h229/PostMan.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Console Log in azure</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh417qRQaPQB499kgq-Ubjoy0zV9elpM7f1lTtM_fwsIaOEj8bGCgXJwYtA5QgPGLLARFsvmaWq_P2TKbWFQwHo0tG-BQkKcfa0rcXX1FIwu0xoYnQV42navOuSz0au90YANimW7dn3b9k/s604/TestFunc.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="390" data-original-width="604" height="259" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh417qRQaPQB499kgq-Ubjoy0zV9elpM7f1lTtM_fwsIaOEj8bGCgXJwYtA5QgPGLLARFsvmaWq_P2TKbWFQwHo0tG-BQkKcfa0rcXX1FIwu0xoYnQV42navOuSz0au90YANimW7dn3b9k/w400-h259/TestFunc.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div><br /></span></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-73182185780117342072021-04-17T16:50:00.006+05:302021-04-18T15:41:29.793+05:30My Azure Study Note 07- Container, Kubernetes, Docker<p><b> Containers</b></p><p>A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.</p><p><b>Advantage of using Containers</b></p><p></p><ul style="text-align: left;"><li><b>Predictability - </b> The same package is deployed from the dev machine to test to prod</li><li><b>Performance - </b>Containers goes up in seconds vs minutes in VM</li><li><b>Density - </b>One server can run thousands of containers vs dozens of VMs</li></ul><div><b>Disadvantage</b></div><div> <b>Isolation</b>- Containers share the same of, so isolation is lighter than VM</div><div><br /></div><div><b>Build and Deploy image to ACR using VS Code</b></div><div><b><br /></b></div><div>Step 1. Install Docker for windows</div><div>Step 2. Install Azure CLI</div><div>Step 3. Open project in VS code and Add extension "Docker"</div><div>Step 4. Open Explorer in VS code, right click on Dockerfile and <b>Build Image</b></div><div><br /></div><div>Content of docker file is as below</div><div><br /></div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #c586c0;">FROM</span> mcr.microsoft.com/<span style="color: #4ec9b0;">dotnet/core/aspnet</span>:<span style="color: #9cdcfe;">3.1</span> <span style="color: #c586c0;">AS</span> <span style="color: #4ec9b0;">base</span></div><div><span style="color: #c586c0;">WORKDIR</span> <span style="color: #9cdcfe;">/app</span></div><div><span style="color: #c586c0;">EXPOSE</span> <span style="color: #9cdcfe;">5004</span></div><div><span style="color: #c586c0;">ENV</span> <span style="color: #9cdcfe;">ASPNETCORE_URLS</span>=<span style="color: #9cdcfe;">http://+:5004</span></div><br /><div><span style="color: #c586c0;">FROM</span> mcr.microsoft.com/<span style="color: #4ec9b0;">dotnet/core/sdk</span>:<span style="color: #9cdcfe;">3.1</span> <span style="color: #c586c0;">AS</span> <span style="color: #4ec9b0;">build</span></div><div><span style="color: #c586c0;">WORKDIR</span> <span style="color: #9cdcfe;">/src</span></div><div><span style="color: #c586c0;">COPY</span> <span style="color: #9cdcfe;">[</span><span style="color: #ce9178;">"cart.csproj"</span><span style="color: #9cdcfe;">,</span> <span style="color: #ce9178;">"./"</span><span style="color: #9cdcfe;">]</span></div><div><span style="color: #c586c0;">RUN</span> <span style="color: #9cdcfe;">dotnet</span> <span style="color: #9cdcfe;">restore</span> <span style="color: #ce9178;">"cart.csproj"</span></div><div><span style="color: #c586c0;">COPY</span> <span style="color: #9cdcfe;">.</span> <span style="color: #9cdcfe;">.</span></div><div><span style="color: #c586c0;">WORKDIR</span> <span style="color: #ce9178;">"/src/."</span></div><div><span style="color: #c586c0;">RUN</span> <span style="color: #9cdcfe;">dotnet</span> <span style="color: #9cdcfe;">build</span> <span style="color: #ce9178;">"cart.csproj"</span> <span style="color: #9cdcfe;">-c</span> <span style="color: #9cdcfe;">Release</span> <span style="color: #9cdcfe;">-o</span> <span style="color: #9cdcfe;">/app/build</span></div><br /><div><span style="color: #c586c0;">FROM</span> <span style="color: #4ec9b0;">build</span> <span style="color: #c586c0;">AS</span> <span style="color: #4ec9b0;">publish</span></div><div><span style="color: #c586c0;">RUN</span> <span style="color: #9cdcfe;">dotnet</span> <span style="color: #9cdcfe;">publish</span> <span style="color: #ce9178;">"cart.csproj"</span> <span style="color: #9cdcfe;">-c</span> <span style="color: #9cdcfe;">Release</span> <span style="color: #9cdcfe;">-o</span> <span style="color: #9cdcfe;">/app/publish</span></div><br /><div><span style="color: #c586c0;">FROM</span> <span style="color: #4ec9b0;">base</span> <span style="color: #c586c0;">AS</span> <span style="color: #4ec9b0;">final</span></div><div><span style="color: #c586c0;">WORKDIR</span> <span style="color: #9cdcfe;">/app</span></div><div><span style="color: #c586c0;">COPY</span> <span style="color: #9cdcfe;">--from</span>=<span style="color: #9cdcfe;">publish</span> <span style="color: #9cdcfe;">/app/publish</span> <span style="color: #9cdcfe;">.</span></div><div><span style="color: #c586c0;">ENTRYPOINT</span> <span style="color: #9cdcfe;">[</span><span style="color: #ce9178;">"dotnet"</span><span style="color: #9cdcfe;">,</span> <span style="color: #ce9178;">"cart.dll"</span><span style="color: #9cdcfe;">]</span></div><br /></div></div><div>Step 5. In VS code Docker extension check the <b>Images </b>list</div><div>Step 6. Right click the "latest" image and run</div><div>Step 7. In VS code Docker extension check the <b>Containers </b>list</div><div>Step 8. Right click the target container and "Open in Browser"</div><div>Step 9. It will run the application in browser from container</div><div>Step 10. Click connect registry -> Azure</div><div>Step 11. Right click Subscription -> <b>Create registry</b>-> Type a name like "myacr"-> Hit Enter</div><div>Step 12. Select a SKU = Basic, Select RG , select Location</div><div><i>This will throw exception </i><span face=""Segoe WPC", "Segoe UI", sans-serif" style="background-color: #252526; color: #cccccc; font-size: 13px;">The subscription is not registered to use namespace 'Microsoft.ContainerRegistry'. See https://aka.ms/rps-not-found for how to register subscriptions."</span></div><div>Step 13. Go to the azure portal-> Subscription-> Resource Providers-> Select "<span face=""Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif" style="background-color: #f3f2f1; color: #201f1e; font-size: 13px; font-weight: 600; white-space: nowrap;">Microsoft.ContainerRegistry" and Register</span></div><div>Step 14. In cloud shell check the registration status by following command</div><div>az provider show --namespace <span face=""Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif" style="background-color: #f3f2f1; color: #201f1e; font-size: 13px; font-weight: 600; white-space: nowrap;">Microsoft.ContainerRegistry -o table</span></div><div>Step 13. Perform step 11 and 12 once again</div><div>Step 14. Check in azure portal-> Container registry</div><div>Step 15. In VS Code ->Images->Latest-> <b>Push </b>image</div><div>Step 16. In Azure portal-> Container Registry -> Repository and check the image</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXmze_PboWpJ5P3auSjzgYJzj5o-4vdQCWkwnaXHRAGovc29VLn1J3EzwVeQrxDE12kBxfvNu3rI-7z6hjHmaELFS303OjBePIEdzxsA5uxOUPXruCg7-WpjlzevIThIDwVUZ5r4ZSTyM/s982/acr.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="656" data-original-width="982" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXmze_PboWpJ5P3auSjzgYJzj5o-4vdQCWkwnaXHRAGovc29VLn1J3EzwVeQrxDE12kBxfvNu3rI-7z6hjHmaELFS303OjBePIEdzxsA5uxOUPXruCg7-WpjlzevIThIDwVUZ5r4ZSTyM/s16000/acr.PNG" /></a></div><br /><div><b>Create AKS Cluster</b></div><div><b><br /></b></div><div>Step 1. In VS Code Terminal run below command to create aks cluster</div><div>az aks create --resource-group <i>readit-app-rg</i> --name <i>cart-aks </i>--node-count <i>1 </i>--generate-ssh-keys --attach-acr readitacr2 --node-vm-size Standard_DS1_v2</div><div><br /></div><div>Step 2. Install CLI of AKS to run kubctl command to perform various option</div><div>az aks install-cli</div><div><br /></div><div>Set path for Kubectl command</div><div>set PATH=%PATH%;"C:\Users\ManabRanjan\.azure-kubectl"</div><div><br /></div><div>Step 3. Get credential to access aks</div><div>az aks get-credentials --resource-group readit-app-rg --name cart-aks</div><div><br /></div><div>If you have multiple subscriptions, check the subscription id</div><div><div>az login</div><div>az account list --output table</div></div><div><br /></div><div>Set the subscription id</div><div>az account set --subscription 0da7d86b-a610-4f8a-97e8-6c44db344baa</div><div><br /></div><div>Step 4. To check everything is fine, run below command</div><div>kubectl get nodes</div><div><br /></div><div>Output as below i.e one node is running. Node is a actual VM where kubernet is setup </div><div><div>NAME STATUS ROLES AGE VERSION</div><div>aks-nodepool1-40111762-vmss000000 Ready agent 3m27s v1.18.14</div></div><div><br /></div><div>Step 5. Go to the portal and type aks</div><div> In Cart-aks, go to the node pool, it will show a node pool with Node count = 1</div><div><br /></div><div>Step 6.</div><div><b>Deploy the app in that AKS</b></div><div>in VS Code, open deployment.yaml</div><div><br /></div><div><div style="background-color: #1e1e1e; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="color: #d4d4d4;"><span style="color: #569cd6;">apiVersion</span>: <span style="color: #ce9178;">apps/v1</span></div><div style="color: #d4d4d4;"><span style="color: #569cd6;">kind</span>: <span style="color: #ce9178;">Deployment</span></div><div style="color: #d4d4d4;"><span style="color: #569cd6;">metadata</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">name</span>: <span style="color: #ce9178;">readit-cart</span></div><div style="color: #d4d4d4;"><span style="color: #569cd6;">spec</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">selector</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">matchLabels</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">app</span>: <span style="color: #ce9178;">readit-cart</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">template</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">metadata</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">labels</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">app</span>: <span style="color: #ce9178;">readit-cart</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">spec</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">containers</span>:</div><div style="color: #d4d4d4;"> - <span style="color: #569cd6;">name</span>: <span style="color: #ce9178;">readit-cart</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">image</span><span style="color: #d4d4d4;">: </span><span style="color: #fbff00;">readitacr2</span><span style="color: #ce9178;">.azurecr.io/cart:latest</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">resources</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">limits</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">memory</span>: <span style="color: #ce9178;">"128Mi"</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">cpu</span>: <span style="color: #ce9178;">"500m"</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">ports</span>:</div><div style="color: #d4d4d4;"> - <span style="color: #569cd6;">containerPort</span>: <span style="color: #b5cea8;">80</span></div><div style="color: #d4d4d4;">---</div><div style="color: #d4d4d4;"><span style="color: #569cd6;">apiVersion</span>: <span style="color: #ce9178;">v1</span></div><div style="color: #d4d4d4;"><span style="color: #569cd6;">kind</span>: <span style="color: #ce9178;">Service</span></div><div style="color: #d4d4d4;"><span style="color: #569cd6;">metadata</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">name</span>: <span style="color: #ce9178;">readit-cart</span></div><div style="color: #d4d4d4;"><span style="color: #569cd6;">spec</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">type</span>: <span style="color: #ce9178;">LoadBalancer</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">ports</span>:</div><div style="color: #d4d4d4;"> - <span style="color: #569cd6;">port</span>: <span style="color: #b5cea8;">80</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">targetPort</span>: <span style="color: #b5cea8;">5004</span></div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">selector</span>:</div><div style="color: #d4d4d4;"> <span style="color: #569cd6;">app</span>: <span style="color: #ce9178;">readit-cart</span> </div><span style="color: #d4d4d4;"><br /></span></div></div><div><b><br /></b></div><div>Run the below command as below for the actual deployment</div><div><br /></div><div>kubectl apply -f deployment.yaml</div><div><br /></div><div>Step 7. In the azure portal, go to the aks cart-aks, go to the "Services and ingresses". </div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2GwpFfFrZX-SRiufPK3aUAUQWzDhwcisrCGmeVsw158zXw8DjFRUCi8xR3A_sciCt_wx1i0Yx9bYhz-cqIrE3wNIFtnFWcsNc0rdrYrXyxdNuVCETcQlWpUpL0v9JE-5xUlEJTksDt88/s1014/Services.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="355" data-original-width="1014" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2GwpFfFrZX-SRiufPK3aUAUQWzDhwcisrCGmeVsw158zXw8DjFRUCi8xR3A_sciCt_wx1i0Yx9bYhz-cqIrE3wNIFtnFWcsNc0rdrYrXyxdNuVCETcQlWpUpL0v9JE-5xUlEJTksDt88/s16000/Services.PNG" /></a></div><br /><div>The first 3 has been created by default but the actual service is readit-cart</div><div><br /></div><div>Go to the workloads where the actual image can be seen found under.</div><div><br /></div><div>Step 8. Go to the "Services and ingresses", click on readit-cart, check the Pod is running and then click on the external IP. It will open the application in the local browser from the container.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEcPY2LrR4Q_ra7TIchZ5bxoqmN9Y1E__TFK9zCzsgib5sUQNp1Q9YLgRmcZF1nRdKyKmjpHGcfSI-b0AZHcsf7byluSQptreYKdgZL-LSXQkWPTyd9PWGhwhyAYIHrasA5C2HDa3ExWQ/s1283/Pod.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="515" data-original-width="1283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEcPY2LrR4Q_ra7TIchZ5bxoqmN9Y1E__TFK9zCzsgib5sUQNp1Q9YLgRmcZF1nRdKyKmjpHGcfSI-b0AZHcsf7byluSQptreYKdgZL-LSXQkWPTyd9PWGhwhyAYIHrasA5C2HDa3ExWQ/s16000/Pod.png" /></a></div><br /><div><br /></div><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-24758596055323677202021-04-17T12:21:00.004+05:302021-04-17T14:19:33.996+05:30My Azure Study Note 06 - Azure icons, App Service and debugging tool<p><b>Download Azure Icons from</b></p><p>https://docs.microsoft.com/en-us/azure/architecture/icons/</p><p><b>App Service Types</b></p><p></p><ul style="text-align: left;"><li>Web Apps</li><li>Web API</li><li>Web Jobs(batch processes)</li></ul><div>Its a PAAS</div><div><b><br /></b></div><div><b>App Service Tires</b></div><div>Free, Basic, Standard, Premium, ISolated</div><div><br /></div><div>https://azure.microsoft.com/en-in/pricing/details/app-service/windows/</div><div><br /></div><div>App Service <b>supports Auto scale</b> based on the Metrics</div><div><br /></div><div><b>Deploy code in App Service from VS Code</b></div><div><br /></div><div>1. Create a app service in azure portal , Publish= Code, Runtime Stack= .net core 3.1, SKU= Free F1</div><div>2. In VS Code, publish the code</div><div>dotnet publish -o publish</div><div><br /></div><div>Right click on Publish folder and selecr "Deploy to web App" and sign in and choose the app service</div><div><br /></div><div>Note : In VS Code , install the extensions - Azure Accounts, Azure App Service, Azure Resources,</div><div>C#</div><div><br /></div><div>3. Browse website</div><div>4. In Azure portal we have some useful feature for debugging like</div><div><br /></div><div>Development Tool -> App Service Editor</div><div>Development Tool -> Console</div><div><br /></div><div>5. Scale up to change the plan from free to paid, if required</div><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-37720929375262960312021-04-16T23:24:00.002+05:302021-04-17T12:05:26.639+05:30My Azure Study Note -05 - Publish Code, VM Setup(windows and ubuntu), Deploy code (from publish and git repo), check communication between VM using private IP<p> Step 1.</p><p>In VS Code publish .NET core application running below command in Terminal</p><p>dotnet publish -o publish</p><p>Step 2. Create a VM(Windows Server 2019 DC Gen1) in azure portal with Static IP Address</p><p>Step 3. RDP to VM</p><p>Step 4. In server manager-> Local Server-> IE Enhanced Security Configuration= False</p><p>Step 5. In server manager-> Dashboard -> Add Roles and Features->Next(3 times)-> Add "Web Server(IIS)"-> Next->Next-> Add Custom Logging and Logging Tools-> Next and Install->Close</p><p>Step 6. In IE, type localhost to ensure the web server is installed</p><p>Step 7. Download google chrome and .NET core 3.1(ASP.NET Core Runtime 3.1.14->Hosting Bundle)</p><p>Step 8. Create a new folder C:\catalog and copy all the contents of publish folder</p><p>Step 9. IIS -> Sites->Add Site-> Name= Catalog, Physical Path= C:\catalog, Port=8080</p><p>Step 10. Browse from IIS and ensure the site is working</p><p>Step 11. To access the site from external system, in the VM open "Windows Defender Firewall" and turn it off both for private and public network. But still the site is not accessible from outside which is the expected behavior and we need to make some changes in the networking</p><p>Step 12. Create a Ubuntu VM "weather-vm" in the same vnet with static ip and enable auto shutdown (within management) and user id and password option</p><p>Step 13. Download Putty to connect that VM</p><p>Step 14. Connect the Unix VM with the Public IP and user id/password</p><p>Step 15. run below command</p><p>sudo apt install git</p><p>sudo apt update</p><p>sudo apt install nodejs (click Y)</p><p>git clone http://github.com/memilavi/WeatherAPI.git</p><p>cd WeatherAPI</p><p>ls</p><p>sudo apt install npm (click Y)</p><p>npm start</p><p>Step 16. copy the private IP address of ubuntu VM</p><p>Step 17. In windows VM browse the catallog app ->click on weather and type the private IP address: 8080 ->click on "Get Weather"</p><p><br /></p><p>This proves that 2 VM in same VNET can communicate each other by private IP address but still not accessible from external network</p><p></p><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><br /><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-67725680752520837262021-04-13T13:28:00.006+05:302021-04-16T22:30:22.369+05:30My Azure Study Note -04 - VM Autoscale, Resource Provider, VM Metadata Service<p><b>Custom Autoscaling Rule</b></p><p><b>Scale Out</b></p><p><br /></p><p></p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiojfhaRMtmaybMukzSNyzk5W30_5lahsFvGfIEkDFNbhQ54bhMr4N3df0b9Fj-xjI0QWJJM0-kjF-uMNYmbbyhWauplbOcWYmS4_jLf8hWOJdJaOUIqHUpIWLBC2yeD12vs-G0a9KVU7c/s1920/Scaleout.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiojfhaRMtmaybMukzSNyzk5W30_5lahsFvGfIEkDFNbhQ54bhMr4N3df0b9Fj-xjI0QWJJM0-kjF-uMNYmbbyhWauplbOcWYmS4_jLf8hWOJdJaOUIqHUpIWLBC2yeD12vs-G0a9KVU7c/s16000/Scaleout.png" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div style="text-align: center;"><b style="text-align: left;"><br /></b></div><div style="text-align: center;"><b style="text-align: left;"><br /></b></div><div style="text-align: center;"><b style="text-align: left;">Scale In</b></div></div><br /><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfNSMq_awkvQBfd1voWYCaFWEe29VAf0q1LIPBeE44G5cb5dHHzbwrLZqhdmJ8yVvSVqntVx8jSAe5T_jsJHs7PrPUX_UXBMBumFtHmYXklt03qBgHk62MiTf7rNac1pbQIRFDTEuXGEE/s1920/ScaleIn.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfNSMq_awkvQBfd1voWYCaFWEe29VAf0q1LIPBeE44G5cb5dHHzbwrLZqhdmJ8yVvSVqntVx8jSAe5T_jsJHs7PrPUX_UXBMBumFtHmYXklt03qBgHk62MiTf7rNac1pbQIRFDTEuXGEE/s16000/ScaleIn.png" /></a></div><br /><b><br /></b><div><b>Register Resource Provider</b><div>By default auto-scaling doesn't support and throws an exception while saving the setting. So need to register "Microsoft.Insight" in subscription to support auto scaling</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB07xJx6IfFvYj_tXjBXzGMfEiTmB8BA4wEvckA2tVeNgVLWgNy6PStEXSp6DkWSY_kRPUWy7S8iODtGoD3_lQ6QsEAELz8qykx5tPcgxziCe_MxZ39v7u6PLaFBsv8DJbqTv6hCe8FFk/s1920/RegisterResourceProvider.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB07xJx6IfFvYj_tXjBXzGMfEiTmB8BA4wEvckA2tVeNgVLWgNy6PStEXSp6DkWSY_kRPUWy7S8iODtGoD3_lQ6QsEAELz8qykx5tPcgxziCe_MxZ39v7u6PLaFBsv8DJbqTv6hCe8FFk/s16000/RegisterResourceProvider.png" /></a></div><br /><div><br /><b>VM Metadata Service</b><p></p></div></div><div>Metadata service is available from any azure VM only after remote login</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq7enGzpg2bxGdWKn3iWApRmWAqqS_FDGQrpFFRQUqJAeEKvm9dtC5Ce-C_NQz4icqwFQPzrSkubHJ0RG3wo72Mn3wqBCn7MeWqmpM-2EaZfOsW5wGIOZ1U6v8pHtxkBn7IHqQlLgSQpw/s1920/Metadata.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq7enGzpg2bxGdWKn3iWApRmWAqqS_FDGQrpFFRQUqJAeEKvm9dtC5Ce-C_NQz4icqwFQPzrSkubHJ0RG3wo72Mn3wqBCn7MeWqmpM-2EaZfOsW5wGIOZ1U6v8pHtxkBn7IHqQlLgSQpw/s16000/Metadata.png" /></a></div><br /><div><br /></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-72200189002413092982021-04-13T12:29:00.000+05:302021-04-13T12:29:21.008+05:30My Azure Study Note -03 - ARM Template, Deployment using ARM Template<p> </p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu8o8mDsZjTvG935_OLjtO0apWYSPEqetqCyTQk61hXMnsuKgNIKDx35w1N3hEkJ7C8hmQ3NaBeq_vDluLxj9TRtMFgUVDtPczzSlFvSg9Kv1eHqCNGfzdEM32hBxODEbYz5sLYnuj_4U/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="612" data-original-width="1121" height="350" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu8o8mDsZjTvG935_OLjtO0apWYSPEqetqCyTQk61hXMnsuKgNIKDx35w1N3hEkJ7C8hmQ3NaBeq_vDluLxj9TRtMFgUVDtPczzSlFvSg9Kv1eHqCNGfzdEM32hBxODEbYz5sLYnuj_4U/w640-h350/image.png" width="640" /></a></div><br /><br /></div><b>Deploy VM using ARM Template</b><p></p><p>Step 1 . Create and Download the ARM Template (Template and parameter.json file ). Edit those files, if required</p><p>Step 2. Go to the storage account -> File Shares</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu8SRGAindG4y7IQhbC-JYIySlaeeCDus9Oap_g0-6ICzxDuoq9UMMJPmaG262iZbzpbzG30hQeHRL5N0YcmAAjJIP1MXdj9Qv07KBPPXO4ZnwkLjUn_uuR0jYk7wY7G-Unxb_umpRMAQ/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="456" data-original-width="1096" height="166" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu8SRGAindG4y7IQhbC-JYIySlaeeCDus9Oap_g0-6ICzxDuoq9UMMJPmaG262iZbzpbzG30hQeHRL5N0YcmAAjJIP1MXdj9Qv07KBPPXO4ZnwkLjUn_uuR0jYk7wY7G-Unxb_umpRMAQ/w400-h166/image.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: left;">Step 3: Click a new Directory example "templates"</div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaBSgZMfflEB9m0PSwchOITdyvaK-M-DhYfwU7W7MMF7IjYpkQsEz8r5S-b6rN8WcQBTYEL7TCweP_nMgosDW54NcNfm1ZkOjAOCayKZqB0SAEfFIAemWbkEf8ErLpwDDB1L_sSqUUh5o/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="240" data-original-width="748" height="129" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaBSgZMfflEB9m0PSwchOITdyvaK-M-DhYfwU7W7MMF7IjYpkQsEz8r5S-b6rN8WcQBTYEL7TCweP_nMgosDW54NcNfm1ZkOjAOCayKZqB0SAEfFIAemWbkEf8ErLpwDDB1L_sSqUUh5o/w400-h129/image.png" width="400" /></a></div>Step 4. Upload both template and parameter.json in that new directory</div><div class="separator" style="clear: both; text-align: left;">Step 5. Create a new RG in azure portal</div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpxM3s3WnlxglgtBA-qsYKZJqhcX-XUL_xv3Xnwdk0eVPfbrNG8fQQ-w9sVrSTdtvJoNrKl9HTufwgbgiPsKtLqxlTsJ8xUh95BhuJ4WfyReYahsx75RpO6uO8_RuCm_DpitfNh3q_Cdo/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="272" data-original-width="383" height="284" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpxM3s3WnlxglgtBA-qsYKZJqhcX-XUL_xv3Xnwdk0eVPfbrNG8fQQ-w9sVrSTdtvJoNrKl9HTufwgbgiPsKtLqxlTsJ8xUh95BhuJ4WfyReYahsx75RpO6uO8_RuCm_DpitfNh3q_Cdo/w400-h284/image.png" width="400" /></a></div>Step 6. Run command in azure Bash</div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioVif1tq1sn0QdJeuq5J2nZomq94nLmAKraQtmaQz6k6meXVZNpOxFMzMP_DGxG4pKPxgfHHRKo9qhmVq0l2khGskzT5bOu9pi9cHs7yzVZbE0YkJLTj-YtvmUKaEhkYV2mJEUXVGqgUs/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="194" data-original-width="1253" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioVif1tq1sn0QdJeuq5J2nZomq94nLmAKraQtmaQz6k6meXVZNpOxFMzMP_DGxG4pKPxgfHHRKo9qhmVq0l2khGskzT5bOu9pi9cHs7yzVZbE0YkJLTj-YtvmUKaEhkYV2mJEUXVGqgUs/s16000/image.png" /></a></div><br /><br /><br /></div><br /><br /><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-29491638817785002602021-04-12T17:24:00.002+05:302021-04-12T17:25:48.464+05:30My Azure Study Note - 02 - VM<p><b><br /></b></p><p><b></b></p><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><b><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbLp-CO-BSxi3BpJr-Zqmb6o-t94Ao4PuwxcieY5_-tr708VBMPAiqNcFAxdt2Vah5xjGvOu1ELQXdiMPNGNkZ5cZRmv_3wA9V657HujlAdMBEHfyVLzCgqW9gTmbZCd1xy5ihRSqyJmk/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="375" data-original-width="636" height="189" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbLp-CO-BSxi3BpJr-Zqmb6o-t94Ao4PuwxcieY5_-tr708VBMPAiqNcFAxdt2Vah5xjGvOu1ELQXdiMPNGNkZ5cZRmv_3wA9V657HujlAdMBEHfyVLzCgqW9gTmbZCd1xy5ihRSqyJmk/" width="320" /></a></div><br /><br /></b></div><b><br /><br /></b><p></p><p><b>How to reduce cost for a VM</b></p><p>Select Auto shutdown (best fit for Dev/Test VMs)</p><p>Reserved Instances (best fit for Prod VMs)</p><p>Spot Instances - Machine that runs on unused capacity in azure. Best fit for non critical, non continuous task</p><p></p><div class="separator" style="clear: both; text-align: center;"><img alt="" border="0" class="placeholder" id="5dd44f2f34d32" src="https://www.blogger.com/img/transparent.gif" style="background-color: #d8d8d8; background-image: url('https://fonts.gstatic.com/s/i/materialiconsextended/insert_photo/v6/grey600-24dp/1x/baseline_insert_photo_grey600_24dp.png'); background-position: 50% 50%; background-repeat: no-repeat; opacity: 0.6;" /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Disk Optimization : Standard SSD instead of Premium SSD</div><div class="separator" style="clear: both; text-align: left;">Select Right Size - CPU shouldn't be rest</div><div class="separator" style="clear: both; text-align: left;">Select Linux over windows</div><div class="separator" style="clear: both; text-align: left;">Check price in nearby regions</div><div class="separator" style="clear: both; text-align: left;"><br /></div><br /><br /><p></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-82954875143885172252021-04-12T09:22:00.006+05:302021-04-12T10:58:08.712+05:30My Azure Study Note - 01 - Types of Cloud, Region and Zone, SLA Calculator, Pricing Calculator<p><b>Public Cloud</b> - Set up in the public network. Accessible through the internet. The client has no access to the underlying infrastructure. </p><p>Examples are AWS, Azure, GCP, IBM Cloud, Oracle Cloud.</p><p><b>Private Cloud - </b>Set up on Prem. Only accessible by the organization. High security.</p><p>Examples are VMWare Cloud, Azure Stack, Red Hat OpenShift Container Platform.</p><p><b>Hybrid Cloud - </b> Setup on-prem but connected to the public cloud. Sensitive data stored in on-prem, public data in the public cloud.</p><p>Examples are Azure ARC, AWS Outposts.</p><p>--------------------------------------------------------------------------------------------------</p><p><b>What is Region: </b>Each datacenters' location is called the region. Microsoft has more than 60 regions.</p><p><b>What is Zone: </b>Some of the regions has more than one physical data centres. Great for availability in case one DC fails. Each physical DC called Zone. Where there is more than one DC in a region, the region is said to have availability zones.</p><p><b>What is Paired Region: </b>Required for Geo-Replication.</p><p>An Azure region consists of a set of data centres deployed within a latency-defined perimeter and connected through a dedicated low-latency network. This ensures that Azure services within an Azure region offer the best possible performance and security</p><p><b>Region Details</b></p><p>https://azure.microsoft.com/en-us/global-infrastructure/geographies/</p><p><b>Services Availability </b></p><p>https://azure.microsoft.com/en-us/global-infrastructure/services/?products=all</p><p><br /></p><p>--------------------------------------------------------------------------------------------------</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbjhNKhiEsF0qbmerIgLAcGoRYeinZrcT8O2XihM4LjWGc6pfzZdQ_kYMlvdbH5aPRr1UdX6hlSM6n1LG6TzjnVZrDREMPXFVE_5evSZrM1FpYF6ANUZgEgo7eX-dzcgdSBM3JFd1V1tA/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="256" data-original-width="906" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbjhNKhiEsF0qbmerIgLAcGoRYeinZrcT8O2XihM4LjWGc6pfzZdQ_kYMlvdbH5aPRr1UdX6hlSM6n1LG6TzjnVZrDREMPXFVE_5evSZrM1FpYF6ANUZgEgo7eX-dzcgdSBM3JFd1V1tA/s16000/image.png" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBQ0JTk6mIweWhO_3Gc9jD4adBxhiWO-5ISDW-X0yN0ePwD6SiK4Im-HwJn7z45ws8_3AIE8GLMAcc5k5cj1nHP4n2jAbYG127owvQw0dlQPOWxe4ULmKR5d58EPVEnTbgkRJvP_-WzS0/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="509" data-original-width="1129" height="144" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBQ0JTk6mIweWhO_3Gc9jD4adBxhiWO-5ISDW-X0yN0ePwD6SiK4Im-HwJn7z45ws8_3AIE8GLMAcc5k5cj1nHP4n2jAbYG127owvQw0dlQPOWxe4ULmKR5d58EPVEnTbgkRJvP_-WzS0/w320-h144/image.png" width="320" /></a></div><br /><b>SLA Calculator :</b><p></p><p>https://uptime.is/</p><p>--------------------------------------------------------------------------------------------------</p><p><b>Pricing Calculator :</b></p><p>https://azure.microsoft.com/en-gb/pricing/calculator/</p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-78947194209234377572021-03-09T04:48:00.004+05:302021-03-12T03:28:07.387+05:30Basic .NET Topics<p> <b>Encapsulation</b> is hiding the
complexity, <b>abstraction</b> is focus on the essential characteristic.</p><div class="separator" style="clear: both;"><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Encapsulation is implemented by using access specifiers. <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; border: none; mso-border-alt: solid #A3A3A3 1.0pt; mso-padding-alt: 0cm 0cm 0cm 0cm; mso-yfti-tbllook: 1184;" summary="" title="">
<tbody><tr>
<td style="background: white; border: 1pt solid rgb(163, 163, 163); padding: 4pt; width: 70.5pt;" valign="top" width="94">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">public<o:p></o:p></span></p>
</td>
<td style="background: white; border-left: none; border: 1pt solid rgb(163, 163, 163); mso-border-left-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 403.05pt;" valign="top" width="537">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">There are no restrictions on accessing public members.<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="background: white; border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 70.5pt;" valign="top" width="94">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">private<o:p></o:p></span></p>
</td>
<td style="background: white; border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 403.05pt;" valign="top" width="537">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Access is limited to within the class definition. This is the default
access modifier type if none is formally specified<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="background: white; border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 70.5pt;" valign="top" width="94">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">protected<o:p></o:p></span></p>
</td>
<td style="background: white; border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 404.55pt;" valign="top" width="539">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Access is limited to within the class definition and any class that
inherits from the class<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="background: white; border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 70.5pt;" valign="top" width="94">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">internal<o:p></o:p></span></p>
</td>
<td style="background: white; border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 403.05pt;" valign="top" width="537">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Access is limited exclusively to classes defined within the current
project assembly<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="background: white; border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 70.5pt;" valign="top" width="94">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">protected internal<o:p></o:p></span></p>
</td>
<td style="background: white; border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 403.05pt;" valign="top" width="537">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Access is limited to the current assembly and types derived from the
containing class. All members in the current project and all members in
derived class can access the variables.<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="background: white; border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 70.5pt;" valign="top" width="94">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">private protected<o:p></o:p></span></p>
</td>
<td style="background: white; border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 403.05pt;" valign="top" width="537">
<p class="MsoNormal" style="line-height: normal;"><span face=""Arial",sans-serif" style="color: #333333; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Access is limited to the containing class or types derived from the
containing class within the current assembly.<o:p></o:p></span></p>
</td>
</tr>
</tbody></table>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Polymorphism</b> is the ability of
different objects to respond in a unique way to the same message.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">An <b>abstract class</b> is a special type of class that cannot be
instantiated. An abstract class is designed to be inherited by subclasses that
either implement or override its methods. ... You can have functionality in
your abstract class—the methods in an abstract class can be both abstract and
concrete.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">When a class is declared <b>sealed</b>, it cannot be inherited, abstract
classes cannot be declared sealed.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">A data type is a <b>value type</b> if it holds a data value within its
own memory space. It means variables of these data types directly contain their
values.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Unlike value types, a <b>reference type</b> doesn't store its value
directly. Instead, it stores the address where the value is being stored. In
other words, a reference type contains a pointer to another memory location
that holds the data.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">The following data types are of reference type:<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">• String<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">• All arrays, even if
their elements are value types<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">• Class<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">• Delegates<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">The process of converting from a value type to a reference type is
called <b>boxing</b>. The process of converting from a reference type to a
value type is called <b>unboxing</b>. <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; border: none; mso-border-alt: solid #A3A3A3 1.0pt; mso-padding-alt: 0cm 0cm 0cm 0cm; mso-yfti-tbllook: 1184;" summary="" title="">
<tbody><tr>
<td style="background: rgb(217, 217, 217); border: 1pt solid rgb(163, 163, 163); padding: 4pt; width: 127.95pt;" valign="top" width="171">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Class</b><o:p></o:p></p>
</td>
<td style="background: rgb(217, 217, 217); border-left: none; border: 1pt solid rgb(163, 163, 163); mso-border-left-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 245.15pt;" valign="top" width="327">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Struct</b><o:p></o:p></p>
</td>
</tr>
<tr>
<td style="border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 127.95pt;" valign="top" width="171">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Reference Type<o:p></o:p></p>
</td>
<td style="border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 245.15pt;" valign="top" width="327">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Value Type<o:p></o:p></p>
</td>
</tr>
<tr>
<td style="border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 127.95pt;" valign="top" width="171">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Support Inheritance<o:p></o:p></p>
</td>
<td style="border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 245.15pt;" valign="top" width="327">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">No Inheritance<o:p></o:p></p>
</td>
</tr>
<tr>
<td style="border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 129.4pt;" valign="top" width="173">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">The reference can be null<o:p></o:p></p>
</td>
<td style="border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 248.75pt;" valign="top" width="332">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Cannot have a null reference (unless Nullable is
used)<o:p></o:p></p>
</td>
</tr>
</tbody></table>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Interfaces</b> are still different
from <b>Abstract</b> classes.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;">Interfaces support
multiple inheritance<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;">Interfaces can NOT
provide implementation of an abstract class<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;">Interface methods are
by default public, while in abstract class one may have private and protected
methods also<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Const</b> is a variable which has to be assigned a value at
compile time. By default, a const is static and we cannot change the value of a
const variable throughout the entire program. <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Readonly</b> is the keyword whose
value we can change during runtime or we can assign it at run time but only
through the non-static constructor. No need to assign a value at compile time.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">A <b>Static Readonly</b> type variable's value can be assigned at
runtime or assigned at compile time and changed at runtime. But this variable's
value can only be changed in the static constructor. And cannot be changed
further. It can change only once at runtime.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>ref and out</b> keywords<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">By default, the value type variable is passed by value, and the
reference type variable is passed by reference from one method to another
method in C#.C# includes ref and out are keywords, which help us to pass the
value type variables to another function by the reference.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">•The ref keyword passes arguments by reference. It means any changes
made to this argument in the method will be reflected in that variable when
control returns to the calling method.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">The out parameters are always passed by reference for both, the value
type and the reference type data types.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">•A variable must be assigned a value before passing as an argument with
the ref keyword. But in out declare a variable without initializing.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">•In the called method, may or may not assign a value for ref parameter.
For out variable, called method must specify the value.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">•We must specify the ref keyword when passing to the method. Otherwise,
it will give a compile-time error. For out, it's Out key word<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Both ref and out are treated differently at run time and they are
treated the same at compile time. So doesn't support overloading if 2 method
one has ref and other has out, the compiler throws exception.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Properties are not variables, therefore it cannot be passed as an out or
ref parameter.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Convert.ToInt32()</b> calls <b>int.Parse()</b>
internally.Except for one thing Convert.ToInt32() returns 0 when argument is
null. <b>TryParse</b>(), Never throws an
exception. Returns false if cannot parse to an integer. It must use out
parameter.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Can “<b>this</b>” be used within a static method ? No, exception is
Extension method.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Properties or accessors : </b>Can be read/write,
read only(only get), write only (only set).<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">A Non Static class can have<b> static method. </b>But Static class
should have Static method and Data member only.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Dispose vs Finalize</b><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 63.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 63pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-indent: -18pt; vertical-align: middle;"><!--[if !supportLists]-->1.<span style="font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
</span><!--[endif]-->Dispose can be called
explicitly by code and Finalize is a non-deterministic method called by GC when
it feels.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 63.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 63pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-indent: -18pt; vertical-align: middle;"><!--[if !supportLists]-->2.<span style="font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
</span><!--[endif]-->Dispose free unmanaged
resources almost immediately , Finalize cleans unmanaged resources when it goes
out of scope.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 63.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 63pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-indent: -18pt; vertical-align: middle;"><!--[if !supportLists]-->3.<span style="font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
</span><!--[endif]-->Dispose is defined in
Idisposable interface, Finalize defined in object class.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 63.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 63pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-indent: -18pt; vertical-align: middle;"><!--[if !supportLists]-->4.<span style="font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
</span><!--[endif]-->In dispose, we have to
write GC.SuppressFinalized()<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">String vs StringBuilder : String is immutable, so every time when its
value changed it will occupy a new memory.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Sealed classes</b> are used to restrict
the inheritance feature of object-oriented programming. Once a class is defined
as a sealed class, the class cannot be inherited. <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>A partial class</b> is only used to split
the definition of a class in two or more classes in the same source code file
or more than one source file. <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Early Binding : </b>Compile time
Polymorphism, <b>Late Binding</b> : Run time Polymorphism<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Unlike arrays, an <b>ArrayList</b> can hold data of multiple data types.
Elements in the ArrayList are accessed via an integer index. A dynamic array
does not have a predefined size using Array.Resize .<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Constructor Chaining</b> is an approach where
a constructor calls another constructor in the same or base class. This is very
handy when we have a class that defines multiple constructors. Example : <a href="https://www.codeproject.com/Articles/271582/Constructor-Chaining-in-Csharp-2"><span style="color: blue;">https://www.codeproject.com/Articles/271582/Constructor-Chaining-in-Csharp-2</span></a><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; border: none; mso-border-alt: solid #A3A3A3 1.0pt; mso-padding-alt: 0cm 0cm 0cm 0cm; mso-yfti-tbllook: 1184;" summary="" title="">
<tbody><tr>
<td style="border: 1pt solid rgb(163, 163, 163); padding: 4pt; width: 256.9pt;" valign="top" width="343">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">CopyTo</span></b><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"><o:p></o:p></span></p>
</td>
<td style="border-left: none; border: 1pt solid rgb(163, 163, 163); mso-border-left-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 216.7pt;" valign="top" width="289">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Clone</span></b><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 256.9pt;" valign="top" width="343">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">The </span><span face=""Arial",sans-serif" style="mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"><a href="http://msdn.microsoft.com/en-us/library/system.array.copyto.aspx"><span style="color: blue;">CopyTo()</span></a><span style="color: #212121;"> method
copies the elements into another existing array</span><o:p></o:p></span></p>
</td>
<td style="border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 221.1pt;" valign="top" width="295">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">The </span><span face=""Arial",sans-serif" style="mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"><a href="http://msdn.microsoft.com/en-us/library/system.array.clone.aspx"><span style="color: blue;">Clone()</span></a><span style="color: #212121;"> method
returns a new array (a shallow copy) object containing all the elements in
the original array.</span><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 256.9pt;" valign="top" width="343">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">CopyTo require to have a
destination array<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"> <o:p></o:p></span></p>
</td>
<td style="border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 216.7pt;" valign="top" width="289">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">when Clone return a new array<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"> <o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="border-top: none; border: 1pt solid rgb(163, 163, 163); mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 256.9pt;" valign="top" width="343">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Does Shallow Copy(i.e the contents
(each array element) contains references to the same object as the elements
in the original array)<o:p></o:p></span></p>
</td>
<td style="border-bottom: 1pt solid rgb(163, 163, 163); border-left: none; border-right: 1pt solid rgb(163, 163, 163); border-top: none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding: 4pt; width: 216.7pt;" valign="top" width="289">
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><span face=""Arial",sans-serif" style="color: #212121; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;">Does Shallow copy as well<o:p></o:p></span></p>
</td>
</tr>
</tbody></table>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>throw ex vs throw</b><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">throw ex resets the stack trace (so your errors would appear to
originate from HandleException)<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">throw doesn't - the original offender would be preserved.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Difference between the Equality Operator (==) and Equals() </b><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Both the == Operator and the Equals() method are used to compare two
value type data items or reference type data items. The Equality Operator (==)
is the comparison operator and the Equals() method compares the contents of a
string. The == Operator compares the reference identity while the Equals()
method compares only contents. Let’s see with some examples.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">In this example, we assigned a string variable to another variable. A
string is a reference type and in the following example, a string variable is
assigned to another string variable so they are referring to the same identity
in the heap and both have the same content so you get True output for both the
== Operator and the Equals() method.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> using
System; <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> namespace
ComparisionExample { <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> class Program { <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> static void Main(string[] args) { <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> string name =
"sandeep"; <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> string myName = name; <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> Console.WriteLine("== operator result
is {0}", name == myName); <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> Console.WriteLine("Equals
method result is {0}", name.Equals(myName)); <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> Console.ReadKey(); <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> }
<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> } <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm; margin-left: 27.0pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0cm 27pt;"> } <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Is vs As Operator</b><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">In C# language, we use the "is" operator to check the object
type. If two objects are of the same type, it returns true, else it returns
false. The "as" operator behaves in a similar way as the
"is" operator. The only difference is it returns the object if both
are compatible with that type. Else it returns a null.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Console.WriteLine(o2 is P1); <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">string str1 = o[q] as string; <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Var vs dynamic</b><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">var is a statically typed variable. So the data type of these variables
are inferred at compile time. dynamic are dynamically typed variables. type is
inferred at run-time and not the compile time. var does not allow the type of
value assigned to be changed after it is assigned to.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Serialization</b> in C# is the process
of converting an object into a stream of bytes to store the object to memory, a
database, or a file. Its main purpose is to save the state of an object in
order to be able to recreate it when needed. <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>Anonymous types</b> allow us to create
new types without defining them. This is a way of defining read-only properties
in a single object without having to define each type explicitly. Here, Type is
generated by the compiler and is accessible only for the current block of code.
The type of properties is also inferred by the compiler.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">We can create anonymous types by using “new” keyword together with the
object initializer. It's used in <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Select clause of LINQ<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Example <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> var anonymousData =
new <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> { <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> ForeName = "Jignesh", <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> SurName = "Trivedi" <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> }; <o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> Console.WriteLine("First
Name : " + anonymousData.ForeName);
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p><b>Through Put in Cosmos DB -</b> </p><div class="separator" style="clear: both;"><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Generally, the speed of a database system is measured by the transaction throughput, expressed as a number of transactions per second. </p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Azure Cosmos DB supports many APIs, such as SQL, MongoDB, Cassandra, Gremlin, and Table. Each API has its own set of database operations. These operations range from simple point reads and writes to complex queries. Each database operation consumes system resources based on the complexity of the operation.<o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">The cost of all database operations is normalized by Azure Cosmos DB and is expressed by <b>Request Units</b> (or RUs, for short). Request unit is a performance currency abstracting the system resources such as CPU, IOPS, and memory that are required to perform the database operations supported by Azure Cosmos DB.<o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">Provisioned throughput mode: In this mode, you provision the number of RUs for your application on a per-second basis in increments of 100 RUs per second. To scale the provisioned throughput for your application, you can increase or decrease the number of RUs at any time in increments or decrements of 100 RUs.<o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"> <o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;"><b>IEnumerable vs IQueryable</b><o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">If you are use IEnumerable when querying data from in-memory collections like List, Array collection etc And when querying data from out-memory (like remote database, service) collections so you are use Iqueryable<o:p></o:p></p><p class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">IQueryable and IEnumerable represent two different things. Think of a IQueryable as a "question", it does not have any results itself. A IEnumerable is an "answer", it only has data connected to it but you can't tell what generated that data.</p></div></div><p><br /></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-77141126653072776832021-03-05T04:37:00.003+05:302021-03-10T05:45:29.889+05:30Call Web API from .NET Core using Polly<p>There is a lot of HttpClient Errors is caused by server overload, temporary network timeouts and generic gliches in the the downstream systems. Those error are temporary and can be dealt with using a retry pattern. In .NET Core, the most common retry library is the Polly library.</p><p><span style="background-color: white; color: #333333; font-family: Georgia, "Bitstream Charter", serif; font-size: 16px;">Step 1. <b>Download the nuget packages</b></span></p><p><span style="background-color: white;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Microsoft.Extensions.Http.Polly</span></span></p><p><span style="background-color: white;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Polly.Extensions.Http</span></span></p><p><span style="background-color: white;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><br /></span></span></p><p><span style="background-color: white;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Step 2. </span></span><strong style="background: rgb(255, 255, 255); border: 0px; color: #333333; font-family: Georgia, "Bitstream Charter", serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;">CONFIGURE SERVICES IN STARTUP.CS</strong></p><div style="text-align: left;"><div><span style="color: #2b00fe;">var serviceProvider = services.BuildServiceProvider();</span></div><div><span style="color: #2b00fe;">var httpSettings = serviceProvider.GetService<IOptions<HttpSettingsOptions>>()?.Value; services.AddHttpClient(HttpClientConstants.HttpClientWithBackOff).AddPolicyHandler(GetRetryPolicy(httpSettings));</span></div></div><p><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><br /></span></p><p><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">IOption is used for strongly typed configuration. We need to download the nuget package Microsoft.Extensions.Options for IOption. We need a class structure that matches with the configuration.</span></p><p><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">So create a class </span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;">HttpSettingsOptions as below</span></p><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">public class HttpSettingsOptions<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> public const string HttpSettings = "HttpSettings";<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> public int RetryCount { get; set; }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> public int InitialRetryDelay { get; set; }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Create the similar structure in appSetting.json<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">{<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "Logging": {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "LogLevel": {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "Default": "Debug",<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "System": "Information",<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "Microsoft": "Information"<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> },<br /></span><span style="color: #2b00fe; font-family: Georgia, Bitstream Charter, serif;"> "HttpSettings": {<br /></span><span style="color: #2b00fe; font-family: Georgia, Bitstream Charter, serif;"> "RetryCount": 3,<br /></span><span style="color: #2b00fe; font-family: Georgia, Bitstream Charter, serif;"> "InitialRetryDelay": 2<br /></span><span style="font-family: Georgia, "Bitstream Charter", serif;"><span style="color: #2b00fe;"> }</span></span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;">,<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "ServiceURL": {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> "Questionnaire": "https://localhost:44368/api"<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">}</span></div><p></p><p><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"></span></p><p>Create a method <span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;">GetRetryPolicy in startup.cs and which accept the above httpsetting</span></p><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy(HttpSettingsOptions options)<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> return HttpPolicyExtensions<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> .HandleTransientHttpError()<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> .WaitAndRetryAsync(options.RetryCount, retryAttempt =><br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> return TimeSpan.FromSeconds(Math.Pow(options.InitialRetryDelay, retryAttempt));<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> });<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }</span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Now for the parameter of </span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;">AddHttpClient methods (i.e</span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;">HttpClientWithBackOff) create a below class<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">public class HttpClientConstants<br /></span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> public const string HttpClientWithBackOff = "HttpClientBackOff";<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }</span></div><p style="text-align: left;"></p><p style="text-align: left;"></p><p style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Step 3: </span><strong style="background: rgb(255, 255, 255); border: 0px; color: #333333; font-family: Georgia, "Bitstream Charter", serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;">USE THE IHttpClientFactory IN THE CALLING CLASS</strong></p><p><strong style="background: rgb(255, 255, 255); border: 0px; color: #333333; font-family: Georgia, "Bitstream Charter", serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-weight: 400;">The </span><strong style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">IHttpClientFactory</strong><span style="font-weight: 400;"> can be injected using constructor injection. The cool part of the Polly implementation is that your </span><strong style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">HttpClient</strong><span style="font-weight: 400;"> code does not contain any special retry-code, just the usual Get or Post calls:</span></strong></p><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">public class QuestionnaireQueryService : IQuestionnaireQueryService<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> private readonly IHttpClientFactory _httpClientFactory;<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> private readonly ServiceURLOptions _serviceUrlOptions;<br /></span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;"> public QuestionnaireQueryService(IOptions<ServiceURLOptions><br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> serviceUrlOptions,<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> IHttpClientFactory httpClientFactory)<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> _serviceUrlOptions = serviceUrlOptions != null<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> ? serviceUrlOptions.Value<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> : throw new ArgumentNullException($"Options/Configuration not found for {nameof(serviceUrlOptions)}");<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> public async Task<QuestionnaireServiceModel> GetAllQuestionnaire()<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> QuestionnaireServiceModel questionnaireServiceModel = null;<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> using var httpClient = _httpClientFactory.CreateClient(HttpClientConstants.HttpClientWithBackOff);<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> //httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + Token);<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> var questionnaireResponse = await httpClient.GetAsync($"{_serviceUrlOptions.Questionnaire}/Questions");<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> var qResponse = await questionnaireResponse.Content.ReadAsStringAsync();<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> if (questionnaireResponse.IsSuccessStatusCode)<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> {<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> questionnaireServiceModel = JsonConvert.DeserializeObject<QuestionnaireServiceModel>(qResponse);<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> return questionnaireServiceModel;<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }<br /></span><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"> }</span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><br /></span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><b>Step 4. Add ServiceURLOptions in ConfigureServices of Startup.cs</b></span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">services.Configure<ServiceURLOptions>(Configuration.GetSection(ServiceURLOptions.ServiceURLs));</span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><br /></span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;">Add below class and make sure </span><span style="color: #333333; font-family: Georgia, "Bitstream Charter", serif;">ServiceURLOptions is present in appsetting.json as per Step 2 Above</span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><br /></span></div><div style="text-align: left;"><span style="color: #333333; font-family: Georgia, Bitstream Charter, serif;"><div> public class ServiceURLOptions</div><div> {</div><div> public const string ServiceURLs = "ServiceURL";</div><div> public string Questionnaire { get; set; } </div><div> }</div></span></div><p><span style="background: rgb(255, 255, 255); border: 0px; color: #333333; font-family: Georgia, "Bitstream Charter", serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;"></span></p>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-50791364788597885652021-03-03T18:27:00.001+05:302021-03-03T18:27:21.123+05:30Integrate Application Insight With .NET Core WebAPI<h1 style="text-align: left;">Configure Azure Web App Configuration</h1><div>Add the below configuration key in the configuration of azure web app</div><div><p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"name":
"Logging.ApplicationInsights.LogLevel.Default",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"value":
"Information",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;">
</span>"slotSetting": false<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>},<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"name":
"Logging.ApplicationInsights.LogLevel.APP1.Service",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"value":
"Debug",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;">
</span>"slotSetting": false<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>},<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"name":
"Logging.ApplicationInsights.LogLevel.Microsoft",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"value":
"Error",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;">
</span>"slotSetting": false<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>},<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"name":
"LogLevel.Default",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"value":
"Information",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;">
</span>"slotSetting": false<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>},<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"name":
"LogLevel.Microsoft",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"value":
"Warning",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;">
</span>"slotSetting": false<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>},<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>{<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"name":
"LogLevel.Microsoft.Hosting.Lifetime",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>"value":
"Information",<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;">
</span>"slotSetting": false<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></p><h1 style="text-align: left;">Add Instrumentation Key in AppSetting.json</h1></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">In application.development.json or Appsetting.loal.json add the APPINSIGHTS_INSTRUMENTATIONKEY key from Azure App Insight</span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><p class="MsoNormal"><span lang="PT" style="color: #2e75b6; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-ansi-language: PT; mso-bidi-font-family: Consolas;">"APPINSIGHTS_INSTRUMENTATIONKEY"</span><span lang="PT" style="color: black; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-ansi-language: PT; mso-bidi-font-family: Consolas;">: </span><span lang="PT" style="color: #a31515; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-ansi-language: PT; mso-bidi-font-family: Consolas;">"9d6e43e7-123c-4bfa-b80e-67c699998a4f"<o:p></o:p></span></p>Add the same key in the web app configuration</span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXB54QKik_uSU3sIFyTZvAz13ewmXU-iYX4soAV0tH6k2hYme4Tc4Mt3gnO5y0rbtro-opJyDooALLolpcqPh2n1hivbomspOh541zhyphenhyphenNfIIsFiJoPUYXqATB5ZSs8sfNMaErFPm7slFA/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="550" data-original-width="856" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXB54QKik_uSU3sIFyTZvAz13ewmXU-iYX4soAV0tH6k2hYme4Tc4Mt3gnO5y0rbtro-opJyDooALLolpcqPh2n1hivbomspOh541zhyphenhyphenNfIIsFiJoPUYXqATB5ZSs8sfNMaErFPm7slFA/s16000/image.png" /></a></div><br />The key can be found from Application insight in azure</span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAhsdPm1tzpLNZ5J8hGXR4y9z3L6HAQP8K7-bBmuxoAkiHTZZSvx3poz2ldCx5vqlRCD8HHQ8XNftS7ns4ZUcbSj3of004fwFqtxinv-qKz7VXvkV2lIDh_2vhyphenhyphenFCOm4uRV2atWzA4794/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="209" data-original-width="1335" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAhsdPm1tzpLNZ5J8hGXR4y9z3L6HAQP8K7-bBmuxoAkiHTZZSvx3poz2ldCx5vqlRCD8HHQ8XNftS7ns4ZUcbSj3of004fwFqtxinv-qKz7VXvkV2lIDh_2vhyphenhyphenFCOm4uRV2atWzA4794/s16000/image.png" /></a></div><br /></span><h1 style="text-align: left;"><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></h1><h1>Install Nuget Package and Configure Applicaton </h1></div><div><br /></div><div>Install the nuget package - Microsoft.Extensions.Logging</div><div><br /></div><div>In Program.cs as below</div><div><br /></div><div><pre class="code highlight" lang="csharp"><span class="line" id="LC1" lang="csharp"><span class="k">using</span> <span class="nn">System</span><span class="p">;</span></span>
<span class="line" id="LC2" lang="csharp"><span class="k">using</span> <span class="nn">System.Collections.Generic</span><span class="p">;</span></span>
<span class="line" id="LC3" lang="csharp"><span class="k">using</span> <span class="nn">System.Linq</span><span class="p">;</span></span>
<span class="line" id="LC4" lang="csharp"><span class="k">using</span> <span class="nn">System.Threading.Tasks</span><span class="p">;</span></span>
<span class="line" id="LC6" lang="csharp"><span class="k">using</span> <span class="nn">Microsoft.AspNetCore.Hosting</span><span class="p">;</span></span>
<span class="line" id="LC7" lang="csharp"><span class="k">using</span> <span class="nn">Microsoft.Extensions.Configuration</span><span class="p">;</span></span>
<span class="line" id="LC8" lang="csharp"><span class="k">using</span> <span class="nn">Microsoft.Extensions.Hosting</span><span class="p">;</span></span>
<span class="line" id="LC9" lang="csharp"><span class="k">using</span> <span class="nn">Microsoft.Extensions.Logging</span><span class="p">;</span></span>
<span class="line" id="LC10" lang="csharp"></span>
<span class="line" id="LC11" lang="csharp"><span class="k">namespace</span> <span class="nn">App1.Service</span></span>
<span class="line" id="LC12" lang="csharp">{</span>
<span class="line" id="LC13" lang="csharp"> <span class="k">public</span> <span class="k">class</span> <span class="nc">Program</span></span>
<span class="line" id="LC14" lang="csharp"> <span class="p">{</span></span>
<span class="line" id="LC15" lang="csharp"> <span class="k">public</span> <span class="k">static</span> <span class="k">void</span> <span class="nf">Main</span><span class="p">(</span><span class="kt">string</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span></span>
<span class="line" id="LC16" lang="csharp"> <span class="p">{</span></span>
<span class="line" id="LC17" lang="csharp"> <span class="nf">CreateHostBuilder</span><span class="p">(</span><span class="n">args</span><span class="p">).</span><span class="nf">Build</span><span class="p">().</span><span class="nf">Run</span><span class="p">();</span></span>
<span class="line" id="LC18" lang="csharp"> <span class="p">}</span></span>
<span class="line" id="LC19" lang="csharp"></span>
<span class="line" id="LC20" lang="csharp"> <span class="k">public</span> <span class="k">static</span> <span class="n">IHostBuilder</span> <span class="nf">CreateHostBuilder</span><span class="p">(</span><span class="kt">string</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span> <span class="p">=></span></span>
<span class="line" id="LC21" lang="csharp"> <span class="n">Host</span><span class="p">.</span><span class="nf">CreateDefaultBuilder</span><span class="p">(</span><span class="n">args</span><span class="p">)</span></span>
<span class="line" id="LC22" lang="csharp"> <span class="p">.</span><span class="nf">ConfigureWebHostDefaults</span><span class="p">(</span><span class="n">webBuilder</span> <span class="p">=></span></span>
<span class="line" id="LC23" lang="csharp"> <span class="p">{</span></span>
<span class="line" id="LC24" lang="csharp"> <span class="n">webBuilder</span><span class="p">.</span><span class="n">UseStartup</span><span class="p"><</span><span class="n">Startup</span><span class="p">>()</span></span>
<span class="line" id="LC25" lang="csharp"> <span class="p">.</span><span class="nf">ConfigureLogging</span><span class="p">(</span></span>
<span class="line" id="LC26" lang="csharp"> <span style="color: #2b00fe;"> <span class="n">builder</span> <span class="p">=></span></span></span><span style="color: #2b00fe;">
<span class="line" id="LC27" lang="csharp"> <span class="p">{</span></span>
<span class="line" id="LC28" lang="csharp"> <span class="n">builder</span><span class="p">.</span><span class="n">AddFilter</span><span class="p"><</span><span class="n">Microsoft</span><span class="p">.</span><span class="n">Extensions</span><span class="p">.</span><span class="n">Logging</span><span class="p">.</span><span class="n">ApplicationInsights</span><span class="p">.</span><span class="n">ApplicationInsightsLoggerProvider</span><span class="p">></span></span>
<span class="line" id="LC29" lang="csharp"> <span class="p">(</span><span class="s">""</span><span class="p">,</span> <span class="n">LogLevel</span><span class="p">.</span><span class="n">Trace</span><span class="p">);</span></span>
<span class="line" id="LC30" lang="csharp"> <span class="p">}</span></span></span>
<span class="line" id="LC31" lang="csharp"> <span class="p">);</span></span>
<span class="line" id="LC32" lang="csharp"></span>
<span class="line" id="LC33" lang="csharp"> <span class="p">});</span></span>
<span class="line" id="LC34" lang="csharp"> <span class="p">}</span></span>
<span class="line" id="LC35" lang="csharp">}</span>
</pre><pre class="code highlight" lang="csharp"><span class="line" lang="csharp"><br /></span></pre><pre class="code highlight" lang="csharp"><h1 style="font-family: "Times New Roman"; white-space: normal;">Configure Startup.cs</h1><div><pre class="code highlight" lang="csharp"><span class="line" id="LC31" lang="csharp"><span class="k">public</span> <span class="k">void</span> <span class="nf">ConfigureServices</span><span class="p">(</span><span class="n">IServiceCollection</span> <span class="n">services</span><span class="p">)</span></span>
<span class="line" id="LC32" lang="csharp"> <span class="p">{</span></span>
<span class="line" id="LC33" lang="csharp"> <span class="n">services</span><span class="p">.</span><span class="nf">AddControllers</span><span class="p">();</span></span>
<span class="line" id="LC34" lang="csharp"> <span class="n">services</span><span class="p">.</span><span class="nf">AddLocalization</span><span class="p">();</span></span>
</pre><pre class="code highlight" lang="csharp"><span class="line" lang="csharp"><span class="p">// The following line enables Application Insights telemetry collection.</span></span></pre><pre class="code highlight" lang="csharp"><span class="line" lang="csharp"><span class="p"><pre class="code highlight" lang="csharp"><span class="line" id="LC53" lang="csharp"><span class="n">services</span><span class="p">.</span><span class="nf">AddApplicationInsightsTelemetry</span><span class="p">(</span><span class="n">options</span> <span class="p">=></span> <span class="p">{</span></span>
<span class="line" id="LC54" lang="csharp"> <span class="n">options</span><span class="p">.</span><span class="n">EnableDebugLogger</span> <span class="p">=</span> <span class="k">true</span><span class="p">;</span></span>
<span class="line" id="LC55" lang="csharp"> <span class="n">options</span><span class="p">.</span><span class="n">InstrumentationKey</span> <span class="p">=</span> <span class="k">this</span><span class="p">.</span><span class="n">Configuration</span><span class="p">.</span><span class="nf">GetSection</span><span class="p">(</span><span class="n">FISResource</span><span class="p">.</span><span class="n">APP_KEY_APPINSIGHTS_INSTRUMENTATIONKEY</span><span class="p">).</span><span class="n">Get</span><span class="p"><</span><span class="kt">string</span><span class="p">>();</span></span>
<span class="line" id="LC56" lang="csharp"> <span class="p">});</span></span>
</pre><pre class="code highlight" lang="csharp"><span class="line" lang="csharp"><span class="p">}</span></span></pre></span></span></pre></div></pre></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-5333662683168095022021-03-03T05:46:00.002+05:302021-03-03T05:46:13.031+05:30Create a Simple .NET Core Web API Structure<h1 style="text-align: left;"> App.Core Project</h1><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Ep3rWPUFXLbE8adrCUQjEv5bEI2FdWM39Uz5rI4eXrFFjGiF1pk9-IFgq5781j5m2IHOI6ASYdiJ-GFVc8AXZT6ClaOM6OnYTQW2Ovc7yha3p1TiWXCxVBryJGaME9S4UJs6fjmFpWA/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="218" data-original-width="232" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Ep3rWPUFXLbE8adrCUQjEv5bEI2FdWM39Uz5rI4eXrFFjGiF1pk9-IFgq5781j5m2IHOI6ASYdiJ-GFVc8AXZT6ClaOM6OnYTQW2Ovc7yha3p1TiWXCxVBryJGaME9S4UJs6fjmFpWA/" width="255" /></a></div><br /><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><b>SharedKernel\BaseEntity.cs</b></div><div><b><br /></b></div><div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div>using System.ComponentModel.DataAnnotations;</div><div><br /></div><div>namespace PairingTest.API.Core.SharedKernel</div><div>{</div><div> public abstract class BaseEntity</div><div> {</div><div> [Required]</div><div> [Key]</div><div> public long Id { get; set; }</div><div> }</div><div>}</div><div style="font-weight: bold;"><br /></div></div><div><b>Entities\Question.cs</b></div><div><b><br /></b></div><div><div>using PairingTest.API.Core.SharedKernel;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.ComponentModel.DataAnnotations;</div><div>using System.Text;</div><div><br /></div><div>namespace PairingTest.API.Core.Entities</div><div>{</div><div> public class Question : BaseEntity</div><div> {</div><div> [Required]</div><div> public string QuestionnaireTitle { get; set; }</div><div> public List<QuestionOption> QuestionOption { get; set; }</div><div> }</div><div>}</div><div><br /></div><div><b>Entities\QuestionOption.cs</b></div><div><b><br /></b></div><div><div>using PairingTest.API.Core.SharedKernel;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.ComponentModel.DataAnnotations;</div><div>using System.Text;</div><div><br /></div><div>namespace PairingTest.API.Core.Entities</div><div>{</div><div> public class QuestionOption : BaseEntity</div><div> {</div><div> [Required]</div><div> public long QuestionID { get; set; }</div><div> public Question QuestionOptionQuestion { get; set; }</div><div> [Required]</div><div> public string QuestionsText { get; set; }</div><div> }</div><div>}</div><div style="font-weight: bold;"><br /></div><div style="font-weight: bold;">Interfaces\IQuestionnaireService.cs</div><div><div><br /></div><div>using PairingTest.API.Core.Entities;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div>using System.Threading.Tasks;</div><div><br /></div><div>namespace PairingTest.API.Core.Interfaces</div><div>{</div><div> public interface IQuestionnaireService</div><div> {</div><div> Task<List<Question>> GetAllQuestionsWithOptions();</div><div> }</div><div>}</div><div><br /></div><div><b>Interfaces\IRepository.cs</b></div><div><b><br /></b></div><div><div>using PairingTest.API.Core.Entities;</div><div>using PairingTest.API.Core.SharedKernel;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div>using System.Threading.Tasks;</div><div><br /></div><div>namespace PairingTest.API.Core.Interfaces</div><div>{</div><div> public interface IRepository</div><div> {</div><div> T Add<T>(T entity) where T : BaseEntity;</div><div> void Update<T>(T entity) where T : BaseEntity;</div><div> void Delete<T>(T entity) where T : BaseEntity;</div><div> Task<List<Question>> GetAllQuestions();</div><div> }</div><div>}</div><div style="font-weight: bold;"><br /></div><div style="font-weight: bold;">Services\QuestionnaireService.cs</div><div style="font-weight: bold;"><br /></div><div><div>using PairingTest.API.Core.Entities;</div><div>using PairingTest.API.Core.Interfaces;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div>using System.Threading.Tasks;</div><div><br /></div><div>namespace PairingTest.API.Core.Services</div><div>{</div><div> public class QuestionnaireService : IQuestionnaireService</div><div> {</div><div> private IRepository repository;</div><div> public QuestionnaireService(IRepository repos)</div><div> {</div><div> this.repository = repos;</div><div> }</div><div> public async Task<List<Question>> GetAllQuestionsWithOptions()</div><div> {</div><div> return await this.repository.GetAllQuestions();</div><div> }</div><div> }</div><div>}</div><div style="font-weight: bold;"><br /></div></div></div><h1> App.Infrastructure Project</h1><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSUYLu52lLcAKx_aPa_O8ODtFMz8VIwCwCIejwSwNOdjqjYbtnPCZIh_iy9XuDTWVToJduDk_TgqMByHOi_dVwDaMVapqPm2KvtuF8jwbGuu-o5fQ5cfyjG0jqtqH56atva5HZXoq-AQA/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="165" data-original-width="236" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSUYLu52lLcAKx_aPa_O8ODtFMz8VIwCwCIejwSwNOdjqjYbtnPCZIh_iy9XuDTWVToJduDk_TgqMByHOi_dVwDaMVapqPm2KvtuF8jwbGuu-o5fQ5cfyjG0jqtqH56atva5HZXoq-AQA/" width="320" /></a></div><br /><br /></div></div></div><div style="font-weight: bold;"><br /></div></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b>Data\PairingTestDBContext.cs</b></div><div><div><br /></div><div>using Microsoft.EntityFrameworkCore;</div><div>using PairingTest.API.Core.Entities;</div><div>using PairingTest.API.Infrastructure.DBMapping;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div><br /></div><div>namespace PairingTest.API.Infrastructure.Data</div><div>{</div><div> public class PairingTestDBContext : DbContext</div><div> {</div><div> public DbSet<Question> Question { get; set; }</div><div> public DbSet<QuestionOption> QuestionOption { get; set; }</div><div><br /></div><div> public PairingTestDBContext(DbContextOptions<PairingTestDBContext> options) : base(options)</div><div> {</div><div><br /></div><div> }</div><div> protected override void OnModelCreating(ModelBuilder modelBuilder)</div><div> {</div><div> base.OnModelCreating(modelBuilder);</div><div><br /></div><div> modelBuilder.Entity<Question>().HasData(</div><div> new { Id =(long) 1, QuestionnaireTitle = "Geography Questions" }</div><div> );</div><div> modelBuilder.Entity<QuestionOption>().HasData(</div><div> new { Id = (long)1, QuestionID = (long)1, QuestionsText = "What is the capital of Cuba?" },</div><div> new { Id = (long)2, QuestionID = (long)1, QuestionsText = "What is the capital of France?" },</div><div> new { Id = (long)3, QuestionID = (long)1, QuestionsText = "What is the capital of Poland?" },</div><div> new { Id = (long)4, QuestionID = (long)1, QuestionsText = "What is the capital of Germany?" }</div><div> );</div><div><br /></div><div> new QuestionMap(modelBuilder.Entity<Question>());</div><div> new QuestionOptionMap(modelBuilder.Entity<QuestionOption>());</div><div> }</div><div> }</div><div>}</div><div style="font-weight: bold;"><br /></div><div style="font-weight: bold;">Data\PairingTestRepository.cs</div><div style="font-weight: bold;"><br /></div><div><div>using Microsoft.EntityFrameworkCore;</div><div>using PairingTest.API.Core.Entities;</div><div>using PairingTest.API.Core.Interfaces;</div><div>using PairingTest.API.Core.SharedKernel;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div>using System.Threading.Tasks;</div><div><br /></div><div>namespace PairingTest.API.Infrastructure.Data</div><div>{</div><div> public class PairingTestRepository : IRepository</div><div> {</div><div> private readonly PairingTestDBContext dbContext;</div><div> public PairingTestRepository(PairingTestDBContext context)</div><div> {</div><div> this.dbContext = context;</div><div><br /></div><div> if (this.dbContext.Database.IsSqlServer())</div><div> {</div><div> this.dbContext.Database.Migrate();</div><div> }</div><div> }</div><div><br /></div><div> public T Add<T>(T entity) where T : BaseEntity</div><div> {</div><div> this.dbContext.Set<T>().Add(entity);</div><div> this.dbContext.SaveChanges();</div><div><br /></div><div> return entity;</div><div> }</div><div><br /></div><div> public void Delete<T>(T entity) where T : BaseEntity</div><div> {</div><div> this.dbContext.Set<T>().Remove(entity);</div><div> this.dbContext.SaveChanges();</div><div> }</div><div><br /></div><div> public void Update<T>(T entity) where T : BaseEntity</div><div> {</div><div> this.dbContext.Entry(entity).State = EntityState.Modified;</div><div> this.dbContext.SaveChanges();</div><div> }</div><div><br /></div><div> public async Task<List<Question>> GetAllQuestions()</div><div> {</div><div> List<Question> lstQuestion = await this.dbContext.Question</div><div> .Include(p=>p.QuestionOption)</div><div> .ToListAsync<Question>();</div><div> return lstQuestion;</div><div> }</div><div> }</div><div>}</div><div><br /></div><div><b>DBMapping\QuestionMap.cs</b></div><div><b><br /></b></div><div><div>using Microsoft.EntityFrameworkCore.Metadata.Builders;</div><div>using PairingTest.API.Core.Entities;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div><br /></div><div>namespace PairingTest.API.Infrastructure.DBMapping</div><div>{</div><div> public class QuestionMap</div><div> {</div><div> public QuestionMap(EntityTypeBuilder<Question> entityBuilder)</div><div> {</div><div> entityBuilder.HasKey(p => p.Id);</div><div> entityBuilder.Property(p => p.QuestionnaireTitle).IsRequired();</div><div> }</div><div> }</div><div>}</div><div style="font-weight: bold;"><br /></div><div><b>DBMapping\QuestionOptionMap.cs</b></div><div><b><br /></b></div><div><div>using Microsoft.EntityFrameworkCore.Metadata.Builders;</div><div>using PairingTest.API.Core.Entities;</div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Text;</div><div><br /></div><div>namespace PairingTest.API.Infrastructure.DBMapping</div><div>{</div><div> public class QuestionOptionMap</div><div> {</div><div> public QuestionOptionMap(EntityTypeBuilder<QuestionOption> entityBuilder)</div><div> {</div><div> entityBuilder.HasKey(p => p.Id);</div><div> entityBuilder.Property(p => p.QuestionsText).IsRequired();</div><div> }</div><div> }</div><div>}</div><div><br /></div><h1 style="text-align: left;">App.WebAPI Project</h1><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDSddudLPYdXhwkX7Rk84cw2xyj_fSZkPj-d5pYGmhjlunNeCUsxHK0FOk7wO331BIpLTkHGIqFY3x_2-yQcm9YuU8gFl-s2fJ9_6vBuiWqppgTZTnnYIVqHSJP3s-pz5DdLGxV2QhQnM/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="268" data-original-width="261" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDSddudLPYdXhwkX7Rk84cw2xyj_fSZkPj-d5pYGmhjlunNeCUsxHK0FOk7wO331BIpLTkHGIqFY3x_2-yQcm9YuU8gFl-s2fJ9_6vBuiWqppgTZTnnYIVqHSJP3s-pz5DdLGxV2QhQnM/" width="234" /></a></div><br /><br /></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b><br /></b></div><div><b>appsettings.Development.json</b></div><div><b><br /></b></div><div><div>{</div><div> "Logging": {</div><div> "LogLevel": {</div><div> "Default": "Debug",</div><div> "System": "Information",</div><div> "Microsoft": "Information"</div><div> }</div><div> },</div><div> "ConnectionStrings": {</div><div> "TESTDB": "Server=(localdb)\\mssqllocaldb;Database=Test01;Trusted_Connection=True;"</div><div> }</div><div>}</div><div><br /></div><div><b>Startup.cs</b></div><div><b><br /></b></div><div><div>using Microsoft.AspNetCore.Builder;</div><div>using Microsoft.AspNetCore.Hosting;</div><div>using Microsoft.Extensions.Configuration;</div><div>using Microsoft.Extensions.DependencyInjection;</div><div>using Microsoft.Extensions.Hosting;</div><div>using PairingTest.API.Infrastructure.Data;</div><div>using PairingTest.WebApi.Interfaces;</div><div>using Microsoft.EntityFrameworkCore;</div><div>using PairingTest.API.Core.Interfaces;</div><div>using PairingTest.API.Core.Services;</div><div><br /></div><div>namespace PairingTest.WebApi</div><div>{</div><div> public class Startup</div><div> {</div><div> public Startup(IConfiguration configuration)</div><div> {</div><div> Configuration = configuration;</div><div> }</div><div><br /></div><div> public IConfiguration Configuration { get; }</div><div><br /></div><div> // This method gets called by the runtime. Use this method to add services to the container.</div><div> public void ConfigureServices(IServiceCollection services)</div><div> {</div><div> services.AddControllers();</div><div> services.AddTransient<IQuestionRepository, QuestionRepository>();</div><div><br /></div><div> services.AddSingleton(this.Configuration);</div><div> string connectionString = this.Configuration.GetConnectionString("TESTDB");</div><div> services.AddDbContext<PairingTestDBContext>(options => options.UseSqlServer(connectionString));</div><div> services.AddScoped<IRepository, PairingTestRepository>();</div><div><br /></div><div> services.AddTransient<IQuestionnaireService, QuestionnaireService>(); </div><div><br /></div><div> }</div><div><br /></div><div> // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.</div><div> public void Configure(IApplicationBuilder app, IWebHostEnvironment env)</div><div> {</div><div> if (env.IsDevelopment())</div><div> {</div><div> app.UseDeveloperExceptionPage();</div><div> }</div><div><br /></div><div> app.UseHttpsRedirection();</div><div> </div><div> app.UseRouting();</div><div><br /></div><div> app.UseAuthorization();</div><div><br /></div><div> app.UseEndpoints(endpoints =></div><div> {</div><div> endpoints.MapControllers();</div><div> });</div><div> }</div><div> }</div><div>}</div><div><br /></div><div><b>Interfaces\IQuestionRepository.cs</b></div><div><div>namespace PairingTest.WebApi.Interfaces</div><div>{</div><div> public interface IQuestionRepository</div><div> {</div><div> Questionnaire GetQuestionnaire();</div><div> }</div><div>}</div><div><br /></div><div><b>Controllers\QuestionsController.cs</b></div><div><b><br /></b></div><div><div>using Microsoft.AspNetCore.Mvc;</div><div>using PairingTest.API.Core.Interfaces;</div><div>using PairingTest.WebApi.Interfaces;</div><div><br /></div><div>namespace PairingTest.WebApi.Controllers</div><div>{</div><div> [Route("api/[controller]")]</div><div> public class QuestionsController : Controller</div><div> {</div><div> private readonly IQuestionRepository _questionRepository;</div><div> private IQuestionnaireService questionnaireService;</div><div> public QuestionsController(IQuestionRepository questionRepository, IQuestionnaireService _questionnaireService)</div><div> {</div><div> _questionRepository = questionRepository;</div><div> this.questionnaireService = _questionnaireService;</div><div> }</div><div><br /></div><div> // GET api/questions</div><div> [HttpGet]</div><div> public Questionnaire Get() //public async Task<IActionResult> Get()</div><div> {</div><div> var x =this.questionnaireService.GetAllQuestionsWithOptions().Result;</div><div> return _questionRepository.GetQuestionnaire();</div><div> }</div><div>}</div><div>}</div></div><div style="font-weight: bold;"><br /></div></div></div><div style="font-weight: bold;"><br /></div></div><div style="font-weight: bold;"><br /></div></div></div><div style="font-weight: bold;"><br /></div></div></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0tag:blogger.com,1999:blog-5019357135976515718.post-18120567639154062192021-03-03T04:35:00.003+05:302021-03-03T04:55:19.692+05:30Use of XUnit in .NET Core application - Part 04: Mocking and Test Coverage<p> </p><div class="separator" style="clear: both; text-align: left;"><h2 style="text-align: left;">Model Error</h2><p class="MsoNormal"><o:p></o:p></p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGuZ-pnx19V61CjaEcRXdLrzahINxS-c8p8iqSCU1dw8WZUVJ6DvzT43SE-wRa99Z1-tbFx3huVF7VOpqoC0DS61xwADEvNLmQYQ1IlIm9HqouiNdTyr1bw-NJAp-cjcrTOwjuSftP2rM/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="312" data-original-width="601" height="332" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGuZ-pnx19V61CjaEcRXdLrzahINxS-c8p8iqSCU1dw8WZUVJ6DvzT43SE-wRa99Z1-tbFx3huVF7VOpqoC0DS61xwADEvNLmQYQ1IlIm9HqouiNdTyr1bw-NJAp-cjcrTOwjuSftP2rM/w640-h332/image.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC3CuTRd-No4haHTIkmhyphenhyphenLl9D42P33V0-s1uMFQmAyNiNx3boa-IFWACVuoxPcqEmaoDJ-3pEFw8QJyZ24qGTBr7qNv3TJ_zUw57f-H2qjFBHRGHuDLm08U_SZ50VGSsYelpj1-K2eNYU/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="153" data-original-width="602" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC3CuTRd-No4haHTIkmhyphenhyphenLl9D42P33V0-s1uMFQmAyNiNx3boa-IFWACVuoxPcqEmaoDJ-3pEFw8QJyZ24qGTBr7qNv3TJ_zUw57f-H2qjFBHRGHuDLm08U_SZ50VGSsYelpj1-K2eNYU/w640-h162/image.png" width="640" /></a></div><br /><br /><p></p><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><h2>Mocking – Set Object<o:p></o:p></h2><div>If we have to mock below httpcontext class, model and loginservice I order to do unit test of login method</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibAt439h2cSlAo1i6qXbnbkOe9lsZQ3qNGqBICuOvW91QDdG77fQbi8PoGS0pp3OOQS7hSQzbEr80uMYXEGSTxd4Q_nW_JkJiIB3yWo0dKGxjyGYboWevsR_gqlmsbK1CKBfh8zdNTeQQ/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="306" data-original-width="602" height="326" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibAt439h2cSlAo1i6qXbnbkOe9lsZQ3qNGqBICuOvW91QDdG77fQbi8PoGS0pp3OOQS7hSQzbEr80uMYXEGSTxd4Q_nW_JkJiIB3yWo0dKGxjyGYboWevsR_gqlmsbK1CKBfh8zdNTeQQ/w640-h326/image.png" width="640" /></a></div><br /><br /><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal"><br /></p><p class="MsoNormal">Test Method<o:p></o:p></p><p class="MsoNormal">Mocking of httpcontext in constructor<o:p></o:p></p><p class="MsoNormal"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPXKjKUD0X7RSd4l1srjX3DLiiur5bFhcPe-sT2tj2ScRZPCSa7pCEmcdjFzdxcbwl-YZ9XLjbocIuCukaqGXunmS4iwec8f53Q6uhsNLE0s5-vVHmN1NkNa-rOw_DsPe0dE8s4m0TXSw/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="316" data-original-width="602" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPXKjKUD0X7RSd4l1srjX3DLiiur5bFhcPe-sT2tj2ScRZPCSa7pCEmcdjFzdxcbwl-YZ9XLjbocIuCukaqGXunmS4iwec8f53Q6uhsNLE0s5-vVHmN1NkNa-rOw_DsPe0dE8s4m0TXSw/w640-h336/image.png" width="640" /></a></div><br /><br /><p></p><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><b>Note
the mock class and mock service and ReturnAsAsync and Mock.of shortcut</b></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><div class="separator" style="clear: both; font-weight: bold; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBmnYRJGrMZjRA2L0ybfToB-0aBK0xC8qDstn6QBQ7lkaMMBjNQ9h3FTyu2VKQvg0ndWCuTetrmulaw30wmG7iFo6Jblg9LPDMKoG3bAZzcygLDHnODBt7I1O7Ti2ULp0q-vuzj9dxEj4/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="144" data-original-width="602" height="154" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBmnYRJGrMZjRA2L0ybfToB-0aBK0xC8qDstn6QBQ7lkaMMBjNQ9h3FTyu2VKQvg0ndWCuTetrmulaw30wmG7iFo6Jblg9LPDMKoG3bAZzcygLDHnODBt7I1O7Ti2ULp0q-vuzj9dxEj4/w640-h154/image.png" width="640" /></a><br /><br /></div><div class="separator" style="clear: both; font-weight: bold; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><p class="MsoNormal" style="text-align: left;">But as the email address is not using for password
comparison, we can ignore that by below code<b><o:p></o:p></b></p><p class="MsoNormal" style="text-align: left;"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD5c7cobrrqe0Nd2kjDyIW6zq9cpERh9gYY9q0sZPVymZ4NlHNgu8IpPuTJBnBDsIjhHhFpzmuA08ymT9Hwjl7vxYGwdgOKEYIPnTK384zuryjZG-I_98p5rbIVGB7M6ALM1PvCy4_A4k/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="134" data-original-width="602" height="142" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD5c7cobrrqe0Nd2kjDyIW6zq9cpERh9gYY9q0sZPVymZ4NlHNgu8IpPuTJBnBDsIjhHhFpzmuA08ymT9Hwjl7vxYGwdgOKEYIPnTK384zuryjZG-I_98p5rbIVGB7M6ALM1PvCy4_A4k/w640-h142/image.png" width="640" /></a></div><br /><br /><p></p><p class="MsoNormal" style="text-align: left;"><br /></p><p class="MsoNormal" style="text-align: left;"><br /></p><p class="MsoNormal" style="text-align: left;"><br /></p><p class="MsoNormal" style="text-align: left;"><br /></p><p class="MsoNormal" style="text-align: left;"><b>Final Test method</b><o:p></o:p></p><p class="MsoNormal" style="text-align: left;"><b></b></p><div class="separator" style="clear: both; text-align: center;"><b><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifDGysX7ijgcFxVSX8yQdAClmSteZW1hSj6wBUq8W3nt9AUkMZOIM1y_B2mw6BV1ZCfoKzquJnrOdDMYt45DWjKrKjtLPm4tIKw3SlfnXfEsykB7SWQJYnTk4_jPbEwEA0599LvHBBkaI/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="195" data-original-width="601" height="208" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifDGysX7ijgcFxVSX8yQdAClmSteZW1hSj6wBUq8W3nt9AUkMZOIM1y_B2mw6BV1ZCfoKzquJnrOdDMYt45DWjKrKjtLPm4tIKw3SlfnXfEsykB7SWQJYnTk4_jPbEwEA0599LvHBBkaI/w640-h208/image.png" width="640" /></a></b></div><b><br /><br /></b><p></p></div><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div><div><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-GB; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><h2 style="text-align: left;">Test Coverage<o:p></o:p></h2><div><p class="MsoNormal">Nuget Package – Coverlet<o:p></o:p></p>
<p class="MsoNormal">Add it to the Test Project<o:p></o:p></p><p class="MsoNormal">Run the below command</p><p class="MsoNormal"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwH8DifnAE9fl98Hr9HitJyNKYdakftblhOuYkWmhWTVcHRjwsmc1VLJwKgndEK-_kWnIbIOcgNbZBWeWx7Hrlozlv-OGTrGEF_7gdc87jgste-nDATzflqKM1y2dDhnT3kQP_ioQtDfE/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="26" data-original-width="601" height="28" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwH8DifnAE9fl98Hr9HitJyNKYdakftblhOuYkWmhWTVcHRjwsmc1VLJwKgndEK-_kWnIbIOcgNbZBWeWx7Hrlozlv-OGTrGEF_7gdc87jgste-nDATzflqKM1y2dDhnT3kQP_ioQtDfE/w640-h28/image.png" width="640" /></a></div><br /><br /><p></p><p class="MsoNormal">During CI CD, if you want to store the test coverage result.<o:p></o:p></p><p class="MsoNormal"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgz3mNxxZhGpQHcrYRa-c8wnEHkhd1ccE5utU52gnfqScFHy1H12XtUB1U_krA-B5XLnaRFcEuSd-R5d4EF7vk9hlzMn-9VfDMfmHaolfXHYc3QB4bSxYl89Ngnkj-3yc533zLU6mNF5o/" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" data-original-height="21" data-original-width="601" height="22" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgz3mNxxZhGpQHcrYRa-c8wnEHkhd1ccE5utU52gnfqScFHy1H12XtUB1U_krA-B5XLnaRFcEuSd-R5d4EF7vk9hlzMn-9VfDMfmHaolfXHYc3QB4bSxYl89Ngnkj-3yc533zLU6mNF5o/w640-h22/image.png" width="640" /></a></div><p class="MsoNormal"><br /></p><br /><br /><p></p></div><br /></span></div>Manab Ranjan Basuhttp://www.blogger.com/profile/07661833217989277946noreply@blogger.com0