Showing posts with label Cloud. Show all posts
Showing posts with label Cloud. Show all posts

Thursday, October 5, 2023

// // Leave a Comment

Guide: How to configure Email Alerts to monitor VPN tunnel status in Azure portal

 In today's post, I will explain how to configure Email Alerts to notify you whenever the VPN tunnel status changes from Connected to Disconnected and vice versa.

You need an Active VPN Tunnel to configure the Alerts to Monitor the VPN tunnel Status. Lets get started,

1. Go to your Azure Portal
2. Navigate to Monitor-> Alerts and then click on Create.

                  

 

3.   In condition tab, use the below query to check the VPN status. In Alert logic, set the threshold value as per your requirement. In my case, it's set to 0. This query will evaluated every 10 minutes and you can set the timings as per your requirement and the minimum time you can set is 5 minutes.

       
        AzureDiagnostics
        | where Category == "TunnelDiagnosticLog"
        | where status_s == "Disconnected"
        | where TimeGenerated > ago(5m)

    

 Also, ensure that you have enabled diagnostic logging on your VPN gateway; without that, your Azure Log Analytics will not collect your VPN tunnel logs.

 


Read More

Tuesday, April 11, 2023

// // Leave a Comment

How to Migrate a Team project from Team Foundation Server 2015, 2017, 2018 to Onprem Azure DevOps 2022?

  

Migrating a Team project or TFS Project collection from Team Foundation Server (TFS) to On-prem Azure DevOps Server involves several steps, including preparing the source TFS server, preparing the destination Azure DevOps Server, and migrating the data from TFS to ADO. Below are the general steps you need to follow.
 For this test, I am going o migrate only one Project collection from TFS Server 2015 to Azure DevOps Server 2022.
Before migration, please make sure that you are using the same version of SQL Server on both servers.

The version of SQL Server that you install must exactly match the version on the original server that hosted the databases. This requirement includes the service-pack level, the collation settings, and the language edition. If the match is not exact, you may be unable to restore the data, or Azure DevOps Server may not operate correctly even if you can restore the data.

  1. Make sure you back up your TFS databases before you start the migration. Before migrating your TFS server to Azure DevOps Server, make sure to back up your TFS databases. This will help you to restore your database if something goes wrong with your migration process.

  2. Prepare your Azure DevOps Server: Install and configure your Azure DevOps Server, create the necessary users, groups, and permissions, and set up SMTP Settings, Public URL, binding, SSH

  3. First Detach the TFS Collection on the TFS Server.


4.  Go to the TFS Server backend SQL Server and take the TFS Collection database Offline




5.  Now Copy the MDF and LDF files of the TFS Collection to the New Dev Ops Server backend   SQL Server and attach the database. 

                                       


6. Once you attach the database, Login to the Onprem DevOps Server 2022 and open Azure DevOps Server Administration Console, navigate to Application Tier->Team Project Collections and click on Attach Collection.



7.  Specify your DevOps SQL Server name where we attached the TFS 2015 databases and select your TFS Collection name and click next to attach Team Project Collection. This step takes 5 to 10 minutes depending on your database size.
Make sure you have a backup copy of your database in case something goes wrong with Migration This step changes the schema of your TFS Collection database to a format that is not usable on the previous version of TFS  or DevOps Server.

 8.  The migration tool will copy all the necessary data, including code, work items, test cases, and other artifacts. 

9. Verify your migrated data: After the migration is complete, verify your migrated data to ensure that everything has been migrated correctly. Check your code, work items, test cases, and other artifacts to ensure they are correct.

Read More

Monday, April 10, 2023

// // Leave a Comment

How I Used Azure Log Analytics to Get a CPU Usage on my Azure Virtual Machines

 


In Azure there are many different ways to check your Virtual Machines CPU, Memory, Disk, Services, VPN status/usage. But in this topic I am going to discuss about CPU usage.
Below are the two ways to check CPU usage of the Virtual Machine.

Option 1 -  To check CPU usage of the Virtual Machine, Select the Virtual Machine -> Overview and Click on the Monitoring Tab.

In Monitoring tab, you can check the last 1 hour, 6-hour, 1 day, 30 days of CPU, Disk, Memory, Network usage. Here you can also check the Virtual Machine Availability and Disk IOPS.


If you want to configure Alerts for CPU usage, then you can do it from here. Click "Enable recommended alert rules" and select the Alert which you want to enable.

In my case I have enabled alert if CPU usage reach 80%, Available Memory Bytes is less than 1GB, Disk IOPS more than 95% and so on.


Option 2 -

In Option 1 you have to configure alerts for each and every Virtual Machine. But if I want to do it on my entire Azure subscription, then there is a very simple way to do it using Azure Log Analytics.

First you need to configure your Log Analytics Workspace, you can specify the how many you want to store Log Analytics data while configuring it and by default it is 30 days.

Once you configure your log Analytics Workspace, then go to Log Analytics Workspace -> Logs

Below is an example query to get the CPU usage of all the virtual machines in a Log Analytics workspace:

Perf

| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName != "_Total"

| summarize AggregatedValue = avg(CounterValue) by bin(TimeGenerated, 5m), Computer




This query will show you the CPU usage for the "Processor" object and "% Processor Time" counter for all virtual machines in your Azure subscription. The 'where' will filters out the "_Total" instance, which represents the total CPU usage across all CPU cores. The summarize operator calculates the average CPU usage over a 5-minute of time period for each virtual machine.

You can modify the log Analytic query to filter by specific Virtual machines or time periods by changing the where statements.

Example

Perf

| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName != "_Total"

| summarize AggregatedValue = avg(CounterValue) by bin(TimeGenerated, 15m), Computer

| where Computer startswith "Azure-WEB" or Computer startswith "Azure-AD

Read More