Showing posts from Azure category

How to configure the TLS and resolve errors related to this on Azure web App!

Today, we are going to discuss and see how to configure the TLS and resolve errors related to this. There are different versions of TLS. | Protocol | Published | |---|---| | TLS 1.0 | 1999 | | TLS 1.1 | 2006 | | TLS 1.2 | 2008 | | TLS 1.3 | 2018 | First, you should know what TLS is, for this, you can refer the below two URLs. 1. [https://en.wikipedia.org/wiki/Transport_Layer_Security](https://en.wikipedia.org/wiki/Transport_Layer_Security) 2. [https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/](https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/) We must configure the right TLS on azure web app and on our security service (in my case I am using Cloudflare), if it is not configured properly then we will get the below error. For testing of app's security, make sure you are using Internet Explorer or Microsoft Edge. ```css .my-link { This might be because the site uses outdated or unsafe TLS security settings. If this keeps happening, try contacting the website's owner.; } ``` In order to resolve this issue, you must follow the below steps. **Step 1:** Check your system's internet options on your local system. **Step 2:** If still facing the same issue then check TLS settings on the Azure web app. **Step 3:** Check TLS settings on your middle-security service (In my case I am using Cloudflare). It should match with Azure TLS or the lower version. Refresh your browser and your app is running properly.

Restart Azure Web App Using Azure Logic App

Introduction In this article, we are going to see how to restart the Azure web app using Azure Logic App. I am considering that you know about the azure logic app. If you want to read more about, what is Azure logic app? How does it work? Then refer the below article. [https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-overview](https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-overview) Prerequisite For Creating Logic App which will restart the Azure web app, you must need the following items and access. 1. Azure portal access where Azure web App is deployed. 2. Tenant Id of your azure account 3. Client_id 4. Client_secret 5. Azure Subscription Id 6. Resource Group 7. App name Steps Restart the Azure web app using the Azure logic app will have three simple steps as shown below. We will discuss all these steps in detail in the following section. Start Designing of the Azure Logic App **Step 1: Get Access Token (HTTP)** First, we need to add the HTTP action in-order to generate and get the access token. This action is having a post method and required tenant_id, client_id, and client_secret. ```json "method": "POST" "uri": "https://login.microsoftonline.com/{tenant_id}/oauth2/token" "body": "grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}&resource=https://management.core.windows.net/" "Content-Type": "application/x-www-form-urlencoded" } ``` After execution, we will get a JSON result which will have a access_token value that is required to restart the app. JSON result looks like as below. **Step 2:** Parse the JSON get the body and define the schema using The sample payload to generate the schema. **Step 3: Restart App (HTTP)** For this HTTP request, we need a subscription ID, resource group, and app name of the azure web app. We need to pass the access_token from the previous step in the Authorization field. ```json "method": "POST" "uri": "https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.Web/sites/{webApp_name}/restart?api-version=2016-08-01" "Authorization": "Bearer @{body('Parse_JSON')?['access_token']}", "Content-Type": "application/json" } ``` Run Logic App Your logic app is ready and now run this and see results in history. The Activity Log of the Web App Check the web App activity log. You might need to wait for 1-2 mins in order to update this. Expected Result The Logic app has been configured properly and worked as expected. It is restarting the Azure web app, we can configure this on-demand and set it scheduled. For on-demand, we can use an email receiving event and restart it on receiving an email with a specific subject line. This is as given below. Automate the Logic App on Email Receiving To make this process automated, we can configure the above logic app on receiving an email with some defined text in the subject. Now whenever you receive an email with a defined subject the logic app will run automatically. Summary In the above article, we see how to restart the Azure web app using the logic app. We also see the use of email receiving an event to restart the app. Apart from the restart, we can perform many more operations like stop, start, etc. For more trigger APIs to refer the below URL and configure those in the above logic app accordingly. [https://docs.microsoft.com/en-us/rest/api/appservice/webapps/stop](https://docs.microsoft.com/en-us/rest/api/appservice/webapps/stop)

Setup Azure CI/CD Pipelines using Visual Studio

Introduction Today, we are going to see how to configure Azure DevOps CI/CD and setup Azure Pipeline using visual studio. Not spending the time on what is Azure DevOps and its feature, we are directly moving to CI/CD. How can we configure this using visual studio? We will see this step by step. Once we set up the Azure Pipeline then on each check-in it will build the application and deploy the changes on App Service. In this article, we will see how to configure the CI/CD for a single project in one solution. In the next article, we will see how to configure the CI/CD for multiple projects in one solution. To know about Azure DevOps and its other features, you can refer to the below blog. [Introducing Azure DevOps](https://azure.microsoft.com/en-in/blog/introducing-azure-devops) Prerequisite For configuring the Azure DevOps CI/CD, you need the following tools. 1. Azure DevOps Account 2. Azure Portal Account 3. Visual Studio 2012+ (in my example I am using VS 2019) Steps We will see how to configure CI/CD and setup Azure Pipeline using Azure DevOps. **Step 1:** Create a new project by using the Azure DevOps account. I am using Team Foundation version control, but you can use Git too. **Step 2:** Configure the newly created project in Visual Studio source control on your local system. **Step 3:** Create a new project with a solution in Visual Studio and add this in DevOps Source Control then check in the changes. **Step 4:** Set up Azure Pipelines under the publish settings of your solution. **Step 5:** Wait for a few minutes and then go to the pipelines under Azure DevOps. You will see a new Pipeline created and the build of the project has started. **Step 6:** Check the Deployment Center on the Azure portal for your App Service, for which you have set up the Azure Pipeline in step 4. **Step 7:** If there is no error in the build, then after some time your build has succeeded. It takes a few minutes. In my example, it takes up to 1min 21 sec. **Step 8:** As the build succeeds the new release will be created and started pushing the release changes on the App service. **Step 9:** Check the App by using the URL and you will see the application has deployed. **Step 10:** Change anything in the application, check the changes, and see if Azure DevOps will build the solution and release the changes. After the build was completed the Release was created. Summary This article provides a step-by-step guide to configuring Continuous Integration and Continuous Deployment (CI/CD) pipelines using Azure DevOps and Visual Studio. It outlines the process of creating a new project, setting up source control, and configuring Azure Pipelines to automate builds and deployments to an Azure App Service. By following this guide, developers can streamline their workflow, ensuring every code check-in triggers a build and deployment. The tutorial focuses on a single-project setup, with plans for a multi-project guide in a future article.