Category Archives: Azure
How to connect Azure App configuration using Managed Identity with C# .NET core – Part 2
In this blog we will learn how to connect Azure app configuration via Managed Identity with C# .NET core. Below, we will dive into these topics What is Azure App Configuration Create an App Configuration store Create a function app Connect to an App configuration store Azure App Configuration: Azure App Configuration is a managed service that helps developers centralize their application configuration and feature settings simply and securely. Use Azure App Configuration to store and secure configuration settings for your application in a single location. App configuration offer the following benefits. A fully managed service that can be set up in minutes Flexible key representations and mappings Tagging with labels Point-in-time replay of settings Dedicated UI for feature flag management Create an Azure App Configuration: Step 1: To create a new App Configuration store, sign into the Azure portal. In the upper-left corner of the home page, select Create a resource. In the Search the Marketplace box, enter App Configuration and select and press enter Step 2: Select App Configuration from the search results, and then select Create. Step 3: Click on create button and enter required information. Step 4: Once your app configuration is created, select “configuration explorer” in the left navigation and click on create button to add a new entry. I’m going to add a couple of example entries, all with the same key “AzfApp:Description”, but with different values and Labels. Step 5: Select “Access Keys” in the left navigation pane and copy endpoint and paste it into notepad++ later this will used in function app to read the value from app configuration. Create a Azure Function App: The Azure Functions project template in Visual Studio creates a project that you can publish to a function app in Azure. 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. In Configure your new project, enter a Project name for your project, and then select Create. The function app name must be valid as a C# namespace, so don’t use underscores, hyphens, or any other nonalphanumeric characters. Select Create to create the function project and HTTP trigger function. Connect to App configuration store: Right-click your project, and select Manage NuGet Packages. On the Browse tab, search for and add the Microsoft.Extensions.Configuration.AzureAppConfiguration NuGet package to your project and also add Azure.Identity package to your project. Open Azf_Final_Test_MgmtIdentity.cs, and add the namespaces of the .NET Core configuration and the App Configuration configuration provider. C# code: using Azure.Identity; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration.AzureAppConfiguration; Add below code to read the app configuration value using managed identity. Now build the project if build successful then right click the project and publish in Azure portal. Navigate in the Azure portal to your azure function app that you have just published, select “Identity” from the let navigation pane and click on enable that you want to use. Once you’ve got your identity enabled, make a note of the name (the same name as your app service), which you’ll need in the next step. From your App Configuration service, select “Access control (IAM)” from left navigation pane and click on “Add a role assignment” From the drawer that flies in on the right-hand side, select what fits your scenario. I’m going for “Reader” access only, and since it’s a Function App I select that in the drop down and then it will list all Managed Identities that exist on my App Services: In the list I select: Reader role. I only want to allow my Function App to actually READ data. In the drop-down, I select Function App under the Managed Identities header, which then filters the list by Function App where Managed Identity is enabled. I will see the name of my Function App here, and can select it. Done! We have now successfully configured Managed Identity for our App Configuration service, and the Function App that I just configured can, without credentials since it’s now running under its own identity, access configuration data from this App Configuration store. Now, its time to test the function app, click on Code + Test from left navigation pane and click on Test/Run to check the output. The following image shows the response in the output window returned by the function. Hope this will help.
Share Story :
Service Bus Topic Filters Basics
Learn the Importance of Azure Service Bus Topic Filters with this Blog.
Share Story :
How to Apply Service Bus Topic Subscription Filters?
Learn how to use the SQL and Co-relation Filters for Azure Service Bus Topic Subscription.
Share Story :
How to solve CORs Error
This Blog will guide you on solving the CORs Error. It is a common issue faced by many while configuring and testing their first API in API Management. Few Setting will solve this Problem for you.
Share Story :
Create Azure Logic Apps
Login to https://portal.azure.com/ Search for logic app in search bar in top header. Click on Add. After clicking on Add, a new form opens. Select Subscription, here I selected Pay-As-You-Go. Select Resource group, here I created new Resource group with name AzureLogicAppLearning. Enter Logic App name in my case it is SendEmailOnAccountCreation. Select the location, here I selected Southeast Asia. Now, click Review + Create. After, clicking Create Deployment of app starts. Post deployment completion you will be redirected to App overview page.
Share Story :
Setting Up Notifications in Azure API management Service
`Read this Blog to understand how you can configure API Management notification settings for Users to receive notifications for new subscriptions
Share Story :
How to read files from SharePoint and store in Azure Blob Storage
This blog will help you resolve common errors that one might come across while integration between SharPoint and Azure Blob and will also guide you through how it is achieved.
Share Story :
How to Customize the API management new Developer Portal
Learn how you can customize the new Azure API management Developer Portal.
Share Story :
How to copy data from rest API to Azure data lake via Azure Data Factory
In this blog I am going to explain you how to copy data from rest API to Azure data lake using Azure Data Factory. Step 1: Create an azure storage account via azure portal using your credentials. Step 2: Once your storage creation done, create a container called “restapidata” that will going to use to store rest API data. Step 3: If you have rest API endpoint then its fine otherwise search dummy rest api example in google and copy one of the URL. Here I have taken employee endpoint (http://dummy.restapiexample.com/api/v1/employees) Step 4: Create an Azure Data Factory service in azure portal and create a pipeline. Step 5: Create a link service for rest API. Step 6: Create a link service for Azure data storage. Step 7: Create a dataset for rest API. Step 8: Create a dataset for Azure data lake storage. Step 9: Drag a copy activity in the pipeline and set a general property. Step 10: Set a source property of copy activity. You can also click on preview data to check whether data is populated or not. Step 11: Set a sink property of copy activity. Step 11: Set a mapping property of copy activity. Step 12: Debug the pipeline and check the output. Also click on details to check record proceed. I hope this will help you.
Share Story :
How to capture the detail level logs when Azure Data Factory Pipeline fails or success
In this blog I am going to explain you how to store detail level logs when Azure Data Factory Pipeline fails or success. First you need to create ADF_LogsRecording table using following SQL script. CREATE TABLE [dbo].[ADF_LogsRecording]( [LogsRecordingID] [int] IDENTITY(1,1) NOT NULL, [DataFactoryName] [nvarchar](200) NULL, [PipelineName] [nvarchar](200) NULL, [PipelineId] [nvarchar](200) NULL, [PipelineStartTime] [datetime] NULL, [ErrorCode] [nvarchar](1000) NULL, [ErrorDescription] [nvarchar](max) NULL, [ErrorLogTime] [datetime] NULL, [ActivityID] [nvarchar](100) NULL, [ActivityName] [nvarchar](200) NULL, [ActivityStartTime] [datetime] NULL, [ActivityEndTime] [datetime] NULL, [ActivityDuration] [time](7) NULL, [ActivityStatus] [nvarchar](100) NULL, [Itemcode] [nvarchar](50) NULL, [FrgnName] [nvarchar](100) NULL, [U_COR_BU_TXTS] [nvarchar](max) NULL, [U_COR_BU_TXTQ] [nvarchar](max) NULL, [CreatedOn] [datetime] NULL, CONSTRAINT [PK_ADF_LogsRecording] PRIMARY KEY CLUSTERED ( [LogsRecordingID] ASC )WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[ADF_LogsRecording] ADD CONSTRAINT [DF_CreatedOn] DEFAULT (getdate()) FOR [CreatedOn] GO Also create a store procedure suppose you are going to use in ADF Pipeline. CREATE PROCEDURE [dbo].[sp_ADF_LogsRecording_Insert] ( @DataFactoryName nvarchar(200), @PipelineName nvarchar(200), @PipelineId nvarchar(200), @PipelineStartTime datetime, @ErrorCode nvarchar(1000), @ErrorDescription nvarchar(max), @ErrorLogTime datetime, @ActivityID nvarchar(100), @ActivityName nvarchar(200), @ActivityStartTime datetime, @ActivityEndTime datetime, @ActivityDuration time, @ActivityStatus nvarchar(200), @Itemcode nvarchar(100), @FrgnName nvarchar(200), @U_COR_BU_TXTS nvarchar(max), @U_COR_BU_TXTQ nvarchar(max) ) AS BEGIN INSERT INTO ADF_LogsRecording ( DataFactoryName, PipelineName, PipelineId, PipelineStartTime, ErrorCode, ErrorDescription, ErrorLogTime, ActivityID, ActivityName, ActivityStartTime, ActivityEndTime, ActivityDuration, ActivityStatus, Itemcode, FrgnName, U_COR_BU_TXTS, U_COR_BU_TXTQ ) VALUES ( @DataFactoryName, @PipelineName, @PipelineId, @PipelineStartTime, @ErrorCode, @ErrorDescription, @ErrorLogTime, @ActivityID, @ActivityName, @ActivityStartTime, @ActivityEndTime, @ActivityDuration, @ActivityStatus, @Itemcode, @FrgnName, @U_COR_BU_TXTS, @U_COR_BU_TXTQ ) END We are also creating SQL store procedure to get all record suppose you want to either insert or update in destination. CREATE procedure [dbo].[SP_GETItem] AS BEGIN SELECT itemcode,FrgnName,U_COR_BU_TXTS,U_COR_BU_TXTQ FROM OITM WITH (NOLOCK) END GO CREATE procedure [dbo].[sp_GetItemByItemCode] ( @ItemCode nvarchar(200) ) AS BEGIN SELECT ItemCode,FrgnName,U_COR_BU_TXTS,U_COR_BU_TXTQ FROM OITM where ItemCode=@ItemCode END GO Now create a pipeline Step 1: Use Lookup activity to get all item. Step 2: ForEach activity should use to loop each itemcode wise, configure the settings of foreach activity Step 3: Add a Copy activity inside ForEach activity and set source properties. Set Sink properties as per below screenshot. Step 4: Add Store procedure activity for both Success and Failure of Copy activity. Step 5: Add store procedure activity for success and configure properties as per below screenshot. Step 6: Add store procedure activity for failure and configure properties as per below screenshot. Now when we run the pipeline, based on failure or success of pipeline record level logs were stored in table. I hope this will help you.