Category - Azure

Quickstart: What is Custom Vision?
Jul 22, 2024

Custom Vision Azure AI Custom Vision is an image recognition service that lets you build, deploy, and improve your own image identifier models. An image identifier applies labels to images, according to their visual characteristics. Each label represents a classification or object. Custom Vision allows you to specify your own labels and train custom models to detect them. How Custom Vision Works The Custom Vision service leverages a machine learning algorithm to analyze images for unique features. Here’s a step-by-step overview: Image Submission: Upload sets of images with and without the desired visual characteristics. Labeling: Tag the images with custom labels during submission. Training: The algorithm trains on this data and tests its accuracy using the same images. Deployment: Once trained, the model can be tested, retrained, and deployed in your app to classify images or detect objects. Offline Use: You can also export the model for offline applications.   Getting Started with Custom Vision Step 1: Create a New Project Visit the Custom Vision portal. Click on New Project. Fill in the required fields. Note: Charges apply as per the pricing model.   Step 2: Upload Training Images Navigate to the Training Images section. Click on the Browse button to select images. Add tags to the selected images. Ensure each tag is specific and accurate.   Browse the photos to start training and upload photos.   Add Tags to uploading images.   Uplaod Arround 50+ Photos for seamless training for each Tags. Step 4: Evaluate Model Performance Once training is complete, the model’s performance metrics will be displayed: Precision: Indicates the likelihood of a correct tag prediction. Recall: Shows the percentage of correct predictions out of all possible correct tags. Average Precision (AP): Summarizes precision and recall across different thresholds. To start training: Click on Train Button on the top,   So GO to Performance page, And Click on  Select the quick training for faster results and quick outputs.   Wait Until the Training teration is completed.   Wait until the models are Developed and  Once Training complets then it will show the Charts as per below.   Step 5: Test the Trained Model Click on Quick Test. Select an image to test. Review the precision percentages to understand tag accuracy   Supported Browsers The Custom Vision portal supports the following browsers: Microsoft Edge (latest version) Google Chrome (latest version) Conclusion Azure AI Custom Vision empowers you to create tailored image recognition models with ease. By following the steps outlined in this guide, you can harness the power of AI to enhance your applications.  

Difference between Azure Kubernetes service AKS and service fabric
Jul 21, 2024

Azure Service Fabric and Kubernetes are both popular container orchestration platforms that offer a range of features and capabilities. While they serve similar purposes, there are key differences between the two platforms. What is Kubernetes? Kubernetes is an open source orchestration system for Docker containers. It handles scheduling into nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared intentions. What is Azure Service Fabric? Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable micro services. Service Fabric addresses the significant challenges in developing and managing cloud apps. Azure Service Fabric vs Kubernetes : Infrastructure setup Azure Service Fabric is a platform that abstracts away the underlying infrastructure, allowing developers to focus on building applications. On the other hand, Kubernetes is an open-source platform that can be deployed on any infrastructure, giving users more control over their infrastructure setup.   Deployment and scaling Azure Service Fabric provides built-in support for micro services, making it easy to deploy and scale applications composed of multiple services. In contrast, Kubernetes focuses on managing containers and offers more flexibility in terms of containerization, allowing users to deploy and scale containerized applications   Service discovery and load balancing Azure Service Fabric includes built-in service discovery and load balancing features, making it easier for applications to discover and communicate with other services in the cluster. Kubernetes relies on external tools and services for service discovery and load balancing, offering more flexibility but requiring additional configuration and setup.   Monitoring and diagnostics Azure Service Fabric provides built-in monitoring and diagnostics capabilities, allowing developers to easily monitor the health and performance of their applications. Kubernetes, on the other hand, requires the use of external monitoring and logging tools for monitoring and diagnostics, offering more flexibility but requiring additional setup and configuration.   Application life cycle management Azure Service Fabric provides comprehensive application life cycle management capabilities, including rolling upgrades and versioning, making it easier to manage and upgrade applications. Kubernetes also supports rolling upgrades but does not provide built-in versioning and advanced application life cycle management features.   Support and ecosystem Azure Service Fabric is a Microsoft product and has strong integration with other Azure services, providing a consistent and unified experience for users. Kubernetes, being an open-source platform, has a larger community and ecosystem, with support from major cloud providers and a wide range of third-party tools and services available.   Conclusion  Azure Service Fabric is a platform-as-a-service offering that abstracts away the underlying infrastructure and provides comprehensive application management features. Kubernetes, on the other hand, is an open-source container orchestration platform that offers more flexibility in terms of infrastructure setup and containerization. The choice between the two platforms depends on the specific requirements and preferences of the users.

What should I choose between AWS and Azure?
Jul 19, 2024

Introduction: Today, most businesses and startups use cloud services instead of physical storage devices. Public clouds provide resources over the Internet, which companies can access and pay for as needed. This is easier and cheaper than buying physical desktops because companies can use virtual desktops instead. AWS and Azure are leading cloud providers offering various services and best practices to organizations and users. This article will explore AWS and Azure, compare their differences and helping you to choose between them and much more. What is AWS? AWS, part of Amazon since 2006, is a top cloud service provider offering on-demand computing and APIs to individuals, companies, and governments on a subscription basis. It uses Elastic Compute Cloud for computing, Simple Storage Service for storage, and RDS and DynamoDB for databases. As of 2020, AWS has a 33% market share in the cloud industry. Customers can pay based on their usage and specific needs. On the other hand, Azure is a cloud service provided by Microsoft. What is Azure? Microsoft Azure, originally released as Windows Azure in 2010 and renamed in 2014, it is a cloud service that helps users create, test, deploy, and maintain applications.  It offers free access for the first year and provides virtual machines, fast data processing, and tools for analysis and monitoring. With straightforward and affordable "pay as you go" pricing, Azure supports many programming languages and tools, including third-party software. Offering over 600 services. Azure is very well known for cloud service providers such as Platform as a Service (PaaS) and Infrastructure as a Service (IaaS). Key Differences Between AWS and Azure   Market Share and Reach AWS: AWS is the biggest player in cloud computing, known for its extensive global presence with many regions and availability zones. Azure: Azure is the second-largest cloud provider, gaining popularity for its strong ties to Microsoft services and solutions for businesses. Service Offerings AWS: Offers a wide range of services with a broader selection of computing, storage, database, and machine learning options. Includes Amazon Virtual Private Cloud (VPC), which allows users to create subnets, route tables, private IP address ranges, and network gateways. Provides compute services like EC2, Elastic Beanstalk, AWS Lambda, ECS, etc. Azure: Strong support for hybrid cloud and enterprise services, seamlessly integrating with popular Microsoft products such as Windows Server, Active Directory, and Office 365. Includes services like Azure Virtual Machine, App Service, Azure Functions, and Container service. Popularity AWS: It has larger community support and trust across its customers, with high-profile clients like Netflix, Twitch, LinkedIn, Facebook, BBC, etc. Azure: Not far behind, Azure has many Fortune 500 companies as customers, including Samsung, eBay, Boeing, BMW, etc. Pricing Models AWS: Offers different pricing options like On-Demand, Reserved Instances, and Spot Instances, but its pricing can be complex and charges per hour. Azure: Has competitive pricing options similar to AWS, such as Pay-As-You-Go and charges per minute, Reserved Instances, and Spot pricing. It often provides cost savings for existing Microsoft customers through discounts and credits. Hybrid Cloud and On-premises Integration AWS: AWS Outposts supports hybrid cloud solutions, primarily focusing on cloud-native approaches. Azure: Prioritizes hybrid cloud solutions with services such as Azure Arc and Azure Stack, ensuring smooth integration with Microsoft environments both on-premises and in the cloud. Open Source and DevOps AWS: Supports a broad array of open-source tools and applications. It offers comprehensive DevOps services like AWS CodePipeline, CodeBuild, CodeDeploy, and CodeCommit. Azure: Provides robust support for open-source technologies through partnerships with various open-source communities.   Difference between AWS and Azure: AWS vs Azure   Conclusion Choosing between Azure and AWS depends on your specific business needs, budget, and IT resources. Both offer extensive cloud services and strong security features. If you need a cost-effective solution for smaller workloads, Azure is a good choice. For a scalable and robust solution for larger workloads, AWS is better. Evaluate your options carefully to select the cloud platform that best fits your business requirements

What is Azure Kubernetes Services Aks?
Jul 19, 2024

What is Azure Kubernetes Services Aks? Azure Kubernetes Service (AKS) is a fully managed Kubernetes service offered by Microsoft Azure. It allows you to deploy and manage Kubernetes clusters on the Azure cloud platform. Azure Kubernetes Service makes it easier for developers to deploy, manage and scale containerized applications using Kubernetes. In this article, we will delve deeper into Azure Kubernetes Service and look at its features, benefits, and drawbacks. One of the standout features of AKS lies in its role as an enabler for both development and operations teams. By offering a managed environment, AKS allows developers to channel their efforts towards crafting and refining applications without being burdened by the intricacies of infrastructure provisioning and maintenance. Simultaneously, operations teams benefit from the automation and optimization features inherent to AKS, which simplify the deployment and orchestration of containerized workloads.     Azure Kubernetes Service offers several features that make it an attractive option for developers. These features include: Managed Kubernetes: Azure Kubernetes Service is a fully managed Kubernetes service, meaning that Microsoft manages Kubernetes clusters. This includes provisioning, scaling, and upgrading the Kubernetes clusters. Easy Deployment: AKS makes it easy to deploy Kubernetes clusters on Azure. Developers can deploy a cluster with just a few clicks, making it easy to start with Kubernetes in Azure. High Availability: AKS provides high availability for Kubernetes clusters using multiple nodes in different availability zones. This ensures that the cluster is always available, even in a failure. Security: AKS provides security features such as role-based access control (RBAC) and network security groups (NSGs) to secure Kubernetes clusters. Scalability: AKS allows you to scale your Kubernetes cluster up or down based on your application’s workload. Integration: AKS integrates with other Azure services such as Azure Container Registry, Azure Active Directory, and Azure DevOps.Hybrid cloud capabilities: Azure provides hybrid cloud capabilities, enabling organizations to run Kubernetes clusters both on-premises and in the cloud, and easily move applications between the two environments.        Benefits of Azure Kubernetes Services Simplified Deployment: AKS simplifies the deployment of containerized apps by reducing the complexities of managing infrastructure. Developers can easily use familiar tools and workflows to deploy applications, reducing the learning curve associated with container orchestration. Cost-Efficiency: By leveraging AKS, organizations can achieve cost-efficiency through optimized resource utilization. Avoid unnecessary expenses by scaling resources based on demand, ensuring efficient resource allocation. High Availability: It provides high availability by distributing applications across multiple nodes and availability zones. This ensures that applications remain accessible even in the event of node failures or other infrastructure issues. Security and Compliance: AKS incorporates robust security features, including Azure Active Directory integration, role-based access control (RBAC), and network policies. This helps organizations meet their security and compliance requirements while deploying and managing containerized applications.   Cons of Azure Kubernetes Service Vendor Lock-In: AKS is a Microsoft Azure service, meaning you may be locked into the Azure cloud platform if you choose to use AKS. Cost: AKS is a paid service, which can quickly add up if you have large Kubernetes clusters. Limited Control: AKS is a managed Kubernetes service, meaning that Microsoft manages the Kubernetes cluster. This can limit the level of control you have over the underlying infrastructure. Learning Curve: Although AKS removes the complexity of managing Kubernetes clusters, there is still a learning curve associated with deploying and managing containerized applications on Kubernetes.                                            Why Azure Kubernetes Services? One of the main advantages of AKS is its seamless integration with other Azure services. This makes deploying and managing containerized applications on the Azure cloud platform easy. AKS can be used with Azure Container Registry (ACR) to store and manage container images and Azure DevOps to enable continuous containerized application integration and deployment (CI/CD). Azure Kubernetes Service also simplifies Kubernetes deployment. It automates the deployment, scaling, and management of Kubernetes clusters, so developers can focus on building and deploying their applications. AKS provides features such as automatic scaling, self-healing, and rolling updates, which help ensure that applications are always available and up-to-date. Another advantage of AKS is its high availability. AKS uses multiple nodes in different availability zones, ensuring the Kubernetes cluster is always available. It also supports horizontal scaling, which allows the cluster to adjust automatically to changes in demand. Conclusion Overall, AKS stands out for its seamless integration with Azure services, simplified Kubernetes management, high availability, security features, and Microsoft support.AKS provides a powerful platform for deploying and managing containerized applications, making it easier for organizations to adopt Kubernetes and leverage the full potential of containers in the cloud. Businesses already using Azure for their cloud infrastructure should consider using AKS to deploy and manage their containerized applications.

Serverless computing using Azure Function
Jul 17, 2024

Serverless computing is a widely adopted approach and an extension of the cloud computing model where customers can focus solely on building logic, with the server infrastructure being completely managed by third-party cloud service providers. In Microsoft Azure, serverless computing can be implemented in various ways, one of which is by using Azure Functions. In this blog, we will discuss how to use Azure Functions for serverless computing. Firstly, let us understand the following terms. What Is Serverless Computing? Serverless computing, also known as the Function-as-a-Service (FAAS) approach to building software applications, eliminates the need to manage the server hardware and software by the consumer and be taken care of by third-party vendors. What Are Azure Functions? Azure functions are the serverless solution that provides all the necessary resources to carry out the tasks with minimal lines of code, infrastructure, and cost. The Azure function are a combination of code and event allowing us to write the code in any language. A Step-by-Step Approach For Creating An Azure Function Go to the Azure portal, search for Function App, and select Function App. Create a new Function App and fill in the details accordingly. Basic tab You can select the Runtime stack and version based on your requirements. Here, I am selecting .NET with version 8 and the operating system Windows. Storage You may leave the default values or configure them according to your project requirements. The default values are configured as. Storage account: You may use the existing storage account or create a new account to store your function app. Monitoring Enable the Application insights to monitor the activity. Deployment tab To enable Continuous Integration and Continuous Deployment (CI/CD), you may connect your function app to a repository by authorizing it to GitHub. These are the important things to focus on while creating your function app, you may leave the remaining details as default or customize them according to your requirements. Once you finish configuring your app, you can click the “create” button at the bottom of the page.Now your app will start the process of deployment. Once deployment is done click on go to the resource tab and you will see your function app was created successfully. Now we need to create a function in our function app. As you can see We have various options to choose Visual Studio, VS code, and other editors or CLI. Choose an environment to create your function. I’ve chosen Visual Studio to create my function app. Create an Azure Functions with Visual Studio From the Visual Studio menu, select File > New > Project. In Create a new project, enter functions in the search box, choose the Azure Functions template, and then select Next. Here you can select the function based on your requirements. Here I am selecting Timer trigger function. Then click on the Create button to create a project. You will see that the default Timer trigger function is created. Here I have created one more function called "HTTPTrigger". Here, you can see two JSON files: host.json and local.settings.json. The local.settings.json file stores app settings and settings used by local development tools. Settings in the local.settings.json file are used only when you're running your project locally. When you publish your project to Azure, be sure to also add any required settings to the app settings for the function app. Publish to Azure Use the following steps to publish your project to a function app in Azure. In Solution Explorer, right-click the project and select Publish. In Target, select Azure then Next. Select Azure Function App (Windows) for the Specific target, which creates a function app that runs on Windows, and then select Next. In the Functions instance, You have to select the function that you created on the Azure portal and then click the finish button.  You can see that the publish profile has been added. Now, click on the Publish button to publish the function to Azure. Once the function is published, go to the Azure portal and search for Application Insights. You can find the Application Insights instance with the same name as the function. On the LHS, go to the Transaction search tab under Investigate and click on See all data in the last 24 hours. In the logs, you can see that your function is working properly. Conclusion In a nutshell, Azure functions provide a very precise environment for developers allowing them to more focus on coding rather than then managing infrastructure. This feature plays a key role in building scalable and responsive applications with low cost.

API Response Fix: Simple Solutions
Feb 03, 2024

Simplifying API Responses with AutoWrapper.Core in .NET Core. Handling API responses effectively is a crucial aspect of building robust and user-friendly applications. In .NET Core applications, the AutoWrapper.Core library comes to the rescue, providing a streamlined way to structure and standardize API responses. In this blog post, we'll explore how to use AutoWrapper.Core to create fixed responses for different status codes in your API. Firstly, you'll need to install the AutoWrapper.Core NuGet package. Add the following line to your project's .csproj file: <PackageReference Include="AutoWrapper.Core" Version="4.5.1" /> This package simplifies the process of handling API responses and ensures a consistent format for success, error, and data messages.   Example: Login Method Let's consider a common scenario, the login method, where we want to ensure fixed responses for both successful and unsuccessful attempts. [HttpPost("Login")] public async Task<ApiResponse> Login([FromBody] Login model) { var user = await _userService.GetUserByName(model.UserName); if (user != null && await _userService.CheckUserPassword(user, model.Password)) { var userResponse = await _tokenService.GenerateToken(user); return new ApiResponse(message: "Login Successfully.", result: userResponse, statusCode: 200); } return new ApiResponse(message: "Invalid Credential.", result: null, statusCode: 401); } In this example, we're using AutoWrapper.Core's ApiResponse class to encapsulate our responses. For a successful login attempt (status code 200), we return a positive message along with the user response. In case of invalid credentials (status code 401), an appropriate error message is provided. ApiResponse Class Now, let's take a closer look at the ApiResponse class from AutoWrapper.Core: namespace AutoWrapper.Wrappers; public class ApiResponse { public string Version { get; set; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int StatusCode { get; set; } public string Message { get; set; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool? IsError { get; set; } public object ResponseException { get; set; } public object Result { get; set; } [JsonConstructor] public ApiResponse(string message, object result = null, int statusCode = 200, string apiVersion = "1.0.0.0") { StatusCode = statusCode; Message = message; Result = result; Version = apiVersion; } public ApiResponse(object result, int statusCode = 200) { StatusCode = statusCode; Result = result; } public ApiResponse(int statusCode, object apiError) { StatusCode = statusCode; ResponseException = apiError; IsError = true; } public ApiResponse() { } } The ApiResponse class provides flexibility in constructing responses with different components such as the message, result, and status code. It helps maintain a standardized format for all API responses. Create a Custom Wrapper: AutoWrapper allows you to create a custom wrapper by implementing the IApiResponse interface. You can create a class that implements this interface to customize the fixed response. Here's an example: Create a Custom Wrapper: AutoWrapper allows you to create a custom wrapper by implementing the IApiResponse interface. You can create a class that implements this interface to customize the fixed response. Here's an example: using AutoWrapper.Wrappers; public class CustomApiResponse<T> : ApiResponse<T> { public string CustomProperty { get; set; } public CustomApiResponse(T result, string customProperty) : base(result) { CustomProperty = customProperty; } } Configure AutoWrapper: In your Startup.cs file, configure AutoWrapper to use your custom wrapper. You can do this in the ConfigureServices method: services.AddAutoWrapper(config => { config.UseCustomSchema<CustomApiResponse<object>>(); }); Replace CustomApiResponse<object> with the custom wrapper class you created. Use Custom Wrapper in Controller Actions: Now, you can use your custom wrapper in your controller actions. For example: [ApiController] [Route("api/[controller]")] public class MyController : ControllerBase { [HttpGet] public IActionResult Get() { // Your logic here var data = new { Message = "Hello, World!" }; // Use the custom wrapper var response = new CustomApiResponse<object>(data, "CustomProperty"); return Ok(response); } } Customize the CustomApiResponse according to your needs, and use it in your controller actions. This way, you can integrate AutoWrapper with other packages and customize the fixed response format in your .NET application.   In conclusion, by incorporating AutoWrapper.Core into your .NET Core applications, you can simplify the handling of API responses, making your code more readable, maintainable, and user-friendly. Consider adopting this approach to enhance the overall developer experience and ensure consistency in your API communication.

Your Expert Guide to Azure App Insights
Jan 24, 2024

Are you grappling with performance issues in your project? Look no further—Application Insights is here to help! In this blog post, I'll guide you through the process of configuring and implementing Application Insights to supercharge your application's performance monitoring. Step 1: Installing the Application Insights Package The first crucial step is to integrate the Application Insights package into your project. Simply add the following PackageReference to your project file: <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" /> And Register service in Program.cs or Startup.cs : builder.Services.AddApplicationInsightsTelemetry(); builder.Services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module.EnableSqlCommandTextInstrumentation = true; }); Add connection string in appsettings.json :  "ApplicationInsights": {   "InstrumentationKey": "" } This sets the stage for a seamless integration of Application Insights into your application. Step 2: Unleashing the Power of Application Insights Now that the package is part of your project, let's dive into the benefits it brings to the table:  1. Identify Performance Bottlenecks Application Insights allows you to track the execution time of individual stored procedures, queries, and API calls. This invaluable information helps you pinpoint areas that require optimization, paving the way for improved performance.  2. Monitor Database Interactions Efficiently analyze the database calls made by specific APIs within your application. With this visibility, you can optimize and fine-tune database interactions for enhanced performance.  3. Comprehensive Error and Exception Tracking Application Insights goes beyond performance monitoring by providing detailed information about errors, traces, and exceptions. This level of insight is instrumental in effective troubleshooting, allowing you to identify and resolve issues swiftly.  Step 3: Integration with Azure for Data Collection and Analysis To maximize the benefits of Application Insights, consider integrating it with Azure for comprehensive data collection and analysis. This step amplifies your ability to make informed decisions regarding performance optimization and problem resolution. In conclusion, Application Insights equips you with the tools needed to elevate your application's performance. By identifying bottlenecks, monitoring database interactions, and offering comprehensive error tracking, it becomes a cornerstone for effective troubleshooting and optimization. Stay tuned for more tips and insights on how to harness the full potential of Application Insights for a high-performing application!

Quick CSV to SQL with Azure Databricks | MagnusMinds Blog
Apr 14, 2023

In this blog, we will explore Azure Databricks, a cloud-based analytics platform, and how it can be used to parse a CSV file from Azure storage and then store the data in a database. Additionally, we will also learn how to process stream data and use Databricks notebook in Azure Data Pipeline.   Azure Databricks Overview Azure Databricks is an Apache Spark-based analytics platform that provides a collaborative workspace for data scientists, data engineers, and business analysts. It is a cloud-based service that is designed to handle big data and allows users to process data at scale. Databricks also provides tools for data analysis, machine learning, and visualization. With its integration with Azure Storage, Azure Data Factory, and other Azure services, Azure Databricks can be used to build end-to-end data processing pipelines.   Parsing CSV File from Azure BlobStorage to Database using Azure Databricks Azure Databricks can be used to parse CSV files from Azure Storage and then store the data in a database. Here are the steps to accomplish this:   Configure Various Azure Components 1. Create Azure Resource Group Image 1 2. Create Azure DataBricks Resource  Image 2 3. Create SQL Server Resource  Image 3 4. Create SQL Database Resource Image 4 5. Create Azure Storage Account  Image 5 6. Create Azure DataFactory Resource  Image 6 7. Launch Databricks Resource Workspace  Image 7 8. Create Computing Cluster  Image 8 9. Create New Notebook  Image 9   Parsing CSV File from Azure Storage to Database using Azure Databricks Azure Databricks can be used to parse CSV files from Azure Storage and then store the data in a database. Here are the steps to accomplish this: 1. Create a cluster: First, create a cluster in Azure Databricks as above. A cluster is a group of nodes that work together to process data. 2. Import all the necessary models in the databricks notebook  %python from datetime import datetime, timedelta from azure.storage.blob import BlobServiceClient, generate_blob_sas, BlobSasPermissions import pandas as pd import pymssql import pyspark.sql Code 1 3. Mount Azure Storage: Next, mount the Azure Storage account in Databricks as follows #Configure Blob Connection storage_account_name = "storage" storage_account_access_key="***********************************" blob_container = "blob-container" Code 2 4. Establish The DataBase Connection #DB connection conn = pymssql.connect(server='****************.database.windows.net', user='*****', password='*****', database='DataBricksDB') cursor = conn.cursor() Code 3 5. Parse CSV file: Once the storage account is mounted, you can parse the CSV file using the following code #get a list of all blob from the container blob_list = [] for blob_i in container_client.list_blobs(): blob_list.append(blob_i.name) # print(blob_list)      df_list = [] #Generate SAS key for each file and load to the dataframe  for blob_i in blob_list:     print(blob_i)     sas_i = generate_blob_sas(account_name = storage_account_name,                              container_name = blob_container,                              blob_name = blob_i,                              account_key = storage_account_access_key,                              permission = BlobSasPermissions(read=True),                              expiry = datetime.utcnow() + timedelta(hours=12))       sas_url = 'https://' + storage_account_name +'.blob.core.windows.net/' + blob_container + '/' +blob_i     print(sas_url)          df=pd.read_csv(sas_url)     df_list.append(df) Code 4 6. Transform and Store data in a database: Finally, you can store the data in a database using the following code #Truncate Table Sales Truncate_Query = "IF EXISTS (SELECT * FROM sysobjects WHERE name='sales' and xtype='U') truncate table sales" cursor.execute(Truncate_Query) conn.commit()   # SQL Query For Table Creation create_table_query = "IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='sales' and xtype='U') CREATE TABLE sales (REGION  varchar(max),COUNTRY  varchar(max),ITEMTYPE  varchar(max),SALESCHANNEL  varchar(max),ORDERPRIORITY  varchar(max),ORDERDATE  varchar(max),ORDERID  varchar(max),SHIPDATE  varchar(max),UNITSSOLD  varchar(max),UNITPRICE  varchar(max),UNITCOST  varchar(max),TOTALREVENUE  varchar(max),TOTALCOST  varchar(max),TOTALPROFIT  varchar(max))IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='sales' and xtype='U') CREATE TABLE sales (REGION  varchar(max),COUNTRY  varchar(max),ITEMTYPE  varchar(max),SALESCHANNEL  varchar(max),ORDERPRIORITY  varchar(max),ORDERDATE  varchar(max),ORDERID  varchar(max),SHIPDATE  varchar(max),UNITSSOLD  varchar(max),UNITPRICE  varchar(max),UNITCOST  varchar(max),TOTALREVENUE  varchar(max),TOTALCOST  varchar(max),TOTALPROFIT  varchar(max))" cursor.execute(create_table_query) conn.commit()   #Insert Data From Main DataFrame for rows in df_combined.itertuples(index=False,name=None):     row = str(list(rows))     row_data = row[1:-1]     row_data = row_data.replace("nan","''")     row_data = row_data.replace("None","''") insert_query = "insert into sales (REGION,COUNTRY,ITEMTYPE,SALESCHANNEL,ORDERPRIORITY,ORDERDATE,ORDERID,SHIPDATE,UNITSSOLD,UNITPRICE,UNITCOST,TOTALREVENUE,TOTALCOST,TOTALPROFIT) values ("+row_data+")"     print(insert_query)     cursor.execute(insert_query) conn.commit() Code 5 As, Shown here The data from all the files is loaded to the SQL server Table Image 10   Azure Databricks notebook can be used to process stream data in Azure Data Pipeline. Here are the steps to accomplish this: 1. Create a Databricks notebook: First, create a Databricks notebook in Azure Databricks. A notebook is a web-based interface for working with code and data. 2. Create a job: Next, create a job in Azure Data Factory to execute the notebook. A job is a collection of tasks that can be scheduled and run automatically. 3. Configure the job: In the job settings, specify the Azure Databricks cluster and notebook that you want to use. Also, specify the input and output datasets. 4. Write the code: In the Databricks notebook, write the code to process the stream data. Here is an example code: #from pyspark.sql.functions import window stream_data = spark.readStream \     .format("csv") \     .option("header", "true") \     .schema("<schema>") \     .load("/mnt/<mount-name>/<file-name>.csv")   stream_data = stream_data \     .withWatermark("timestamp", "10 minutes") \     .groupBy(window("timestamp", "10 Code 6   How To Use Azure Databrick notebook in Azure Data Factory pipeline and configure the DataFlow Pipeline Using it. Image 11 1. Create ADF Pipeline  Image 12 2. Configure Data Pipeline  Image 13 3. Add Trigger To the PipeLine  Image 14 4. Configure the trigger  Image 15   These capabilities make Azure Databricks an ideal platform for building real-time data processing solutions. Overall, Azure Databricks provides a scalable and flexible solution for data processing and analytics, and it's definitely worth exploring if you're working with big data on the Azure platform. With its powerful tools and easy-to-use interface, Azure Databricks is a valuable addition to any data analytics toolkit.

Quick Setup: Kafka with ELK Integration
Aug 17, 2020

Apache Kafka is the numerous common buffer solution deployed together with the ELK Stack. Kafka is deployed within the logs delivery and the indexing units, acting as a segregation unit for the data being collected: In this blog, we’ll see how to deploy all the components required to set up a resilient logs pipeline with Apache Kafka and ELK Stack: Filebeat – collects logs and forwards them to a Kafka topic. Kafka – brokers the data flow and queues it. Logstash – aggregates the data from the Kafka topic, processes it and ships to Elasticsearch. Elasticsearch – indexes the data. Kibana – for analyzing the data.   My environment: To perform the steps below, I set up a single Ubuntu 18.04 VM machine on AWS EC2 using local storage. In real-life scenarios, you will probably have all these components running on separate machines. I started the instance in the public subnet of a VPC and then set up a security group to enable access from anywhere using SSH and TCP 5601 (for Kibana). Using Apache Access Logs for the pipeline, you can use VPC Flow Logs, ALB Access logs etc. We will start by installing the main component in the stack — Elasticsearch. Login to your Ubuntu system using sudo privileges. For the remote Ubuntu server using ssh to access it. Windows users can use putty or Powershell to log in to Ubuntu system. Elasticsearch requires Java to run on any system. Make sure your system has Java installed by running the following command. This command will show you the current Java version. sudo apt install openjdk-11-jdk-headless Check the installation is successful or not by the below command ~$ java — versionopenjdk 11.0.3 2019–04–16OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing) Finally, I added a new elastic IP address and associated it with the running instance. The example logs used for the tutorial are Apache access logs.   Step 1: Installing Elasticsearch We will start by installing the main component in the stack — Elasticsearch. Since version 7.x, Elasticsearch is bundled with Java so we can jump right ahead with adding Elastic’s signing key: Download and install the public signing key: wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - Now you may need to install the apt-transport-https package on Debian before proceeding: sudo apt-get install apt-transport-https echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list Our next step is to add the repository definition to our system: echo “deb https://artifacts.elastic.co/packages/7.x/apt stable main” | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list You can install the Elasticsearch Debian package with: sudo apt-get update && sudo apt-get install elasticsearch Before we bootstrap Elasticsearch, we need to apply some basic configurations using the Elasticsearch configuration file at: /etc/elasticsearch/elasticsearch.yml: sudo su nano /etc/elasticsearch/elasticsearch.yml Since we are installing Elasticsearch on AWS, we will bind Elasticsearch to the localhost. Also, we need to define the private IP of our EC2 instance as a master-eligible node: network.host: "localhost" http.port:9200 cluster.initial_master_nodes: ["<InstancePrivateIP"] Save the file and run Elasticsearch with: sudo service elasticsearch start To confirm that everything is working as expected, point curl to: http://localhost:9200, and you should see something like the following output (give Elasticsearch a minute or two before you start to worry about not seeing any response): {   "name" : "elasticsearch",   "cluster_name" : "elasticsearch",   "cluster_uuid" : "W_Ky1DL3QL2vgu3sdafyag",   "version" : {     "number" : "7.2.0",     "build_flavor" : "default",     "build_type" : "deb",     "build_hash" : "508c38a",     "build_date" : "2019-06-20T15:54:18.811730Z",     "build_snapshot" : false,     "lucene_version" : "8.0.0",     "minimum_wire_compatibility_version" : "6.8.0",     "minimum_index_compatibility_version" : "6.0.0-beta1"   },   "tagline" : "You Know, for Search" }   Step 2: Installing Logstash Next up, the “L” in ELK — Logstash. Logstash and installing it is easy. Just type the following command. sudo apt-get install logstash -y Next, we will configure a Logstash pipeline that pulls our logs from a Kafka topic, processes these logs and ships them on to Elasticsearch for indexing. Verify Java is installed: java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode) Let’s create a new config file: Since we already defined the repository in the system, all we have to do to install Logstash is run: sudo nano /etc/logstash/conf.d/apache.conf Next, we will configure a Logstash pipeline that pulls our logs from a Kafka topic, processes these logs, and ships them on to Elasticsearch for indexing. Let’s create a new config file: input {   kafka {     bootstrap_servers => "localhost:9092"     topics => "apache"     } } filter {     grok {       match => { "message" => "%{COMBINEDAPACHELOG}" }     }     date {     match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]     }   geoip {       source => "clientip"     } } output {   elasticsearch {     hosts => ["localhost:9200"]   } } As you can see — we’re using the Logstash Kafka input plugin to define the Kafka host and the topic we want Logstash to pull from. We’re applying some filtering to the logs and we’re shipping the data to our local Elasticsearch instance.   Step 3: Installing Kibana Let’s move on to the next component in the ELK Stack — Kibana. As before, we will use a simple apt command to install Kibana: sudo apt-get install kibana We will then open up the Kibana configuration file at: /etc/kibana/kibana.yml, and make sure we have the correct configurations defined: server.port: 5601 server.host: "<INSTANCE_PRIVATE_IP>" elasticsearch.hosts: ["http://<INSTANCE_PRIVATE_IP>:9200"] Then enable and start the Kibana service: sudo systemctl enable kibana sudo systemctl start kibana We would need to install Firebeat. Use: sudo apt install filebeat   Open up Kibana in your browser with http://<PUBLIC_IP>:5601. You will be presented with the Kibana home page.

magnusminds website loader