Wednesday, 18 June 2025

Move Repository from GitHub to Azure

 Follow the below steps in Terminal 



git clone --mirror https://github.com/your-org/your-repo.git

cd your-repo.git


git remote add azure1 https://dev.azure.com/mycompany/myproject/_git/myproject

git push --mirror azure1

Friday, 13 June 2025

𝐋𝐨𝐚𝐝 𝐁𝐚𝐥𝐚𝐧𝐜𝐢𝐧𝐠 𝐀𝐥𝐠𝐨𝐫𝐢𝐭𝐡𝐦𝐬

 1. Round Robin

It assigns a request to the first server, then moves to the second, third, and so on, and after reaching the last server, it starts again at the first.

2. Least Connections
The Least Connections algorithm directs incoming requests to the server with the lowest number of active connections.

3. Weighted Round Robin
It assigns different weights to servers based on their capacities and distributes requests proportionally to these weights.

4. Weighted Least Connections
The Weighted Least Connections algorithm combines the Least Connections and Weighted Round Robin algorithms. It directs incoming requests to the server with the lowest ratio of active connections to assigned weight.

5. IP Hash
The IP Hash algorithm determines the server to which a request should be sent based on the source and/or destination IP address. This method maintains session persistence, ensuring that requests from a specific user are directed to the same server.

6. Least Response Time
It directs incoming requests to the server with the lowest response time and the fewest active connections.

7. Random
It directs incoming requests to a randomly selected server from the available pool.

8. Least Bandwidth
It directs incoming requests to the server currently utilizing the least amount of bandwidth. This approach helps to ensure that servers are not overwhelmed by network traffic.








Monday, 19 May 2025

CRM on prem server Maintennace Job

 Regarding the index maintenance job, its purpose is to optimize performance by managing indexes, dropping, and recreating them as needed. This process helps prevent SQL errors caused by index length and fragmentation. 

UPDATE ScaleGroupOrganizationMaintenanceJobs

SET RecurrenceStartTime = '2025-05-18 23:30:00.000', RecurrencePattern = 'FREQ=DAILY;INTERVAL=2;', NextRunTime = '2025-05-18 23:30:00.000'

WHERE OperationType in (30, 15) AND OrganizationId = 'place the Organization ID'; 

1. RecurrenceStartTime: Sets the start time for the recurrence to '2025-05-18 23:30:00.000'.
2. RecurrencePattern: Sets the recurrence pattern to 'FREQ=DAILY;INTERVAL=2;', meaning the job will run once every 2 days.
3. NextRunTime: Sets the next run time to '2025-05-18 23:30:00.000.
4. OperationType: Filters the jobs to update by their operation types (15 for Index Management and 30 for Reindexing).
5. OrganizationId: Filters the jobs by the specific organization ID.

SQL Server Index statistic

 Run below query. If any sampling percentage is between 0.1 and 5, then re-build the index and run the statistic

DECLARE @DatabaseName NVARCHAR(255) = 'Database_Name';

 

-- Create a temporary table to store results

CREATE TABLE #StatsUpdateInfo

(

   TableName NVARCHAR(255),

   StatsName NVARCHAR(255),

   RowsModified INT,

   RowsSampled INT,

   SamplingPercentage FLOAT

);

 

-- Cursor to iterate through each table in the database

DECLARE @TableName NVARCHAR(255);

DECLARE table_cursor CURSOR FOR

   SELECT t.name

   FROM sys.tables t

   WHERE t.is_ms_shipped = 0;

 

-- Variables to store dynamic SQL

DECLARE @SQL NVARCHAR(MAX);

 

OPEN table_cursor;

FETCH NEXT FROM table_cursor INTO @TableName;

 

WHILE @@FETCH_STATUS = 0

BEGIN

   -- Dynamic SQL to gather statistics update information for each table

   SET @SQL = '

       INSERT INTO #StatsUpdateInfo

       SELECT

           ''' + @TableName + ''' AS TableName,

           s.name AS StatsName,

           us.rows AS RowsModified,

           us.rows_sampled AS RowsSampled,

           CASE WHEN us.rows_sampled > 0 THEN CAST(us.rows_sampled * 100.0 / us.rows AS FLOAT) ELSE 0 END AS SamplingPercentage

       FROM

           ' + QUOTENAME(@DatabaseName) + '.sys.tables t

           JOIN ' + QUOTENAME(@DatabaseName) + '.sys.stats s ON t.object_id = s.object_id

           OUTER APPLY sys.dm_db_stats_properties(t.object_id, s.stats_id) us

       WHERE

           t.name = ''' + @TableName + ''';

   ';

 

   -- Execute dynamic SQL

   EXEC sp_executesql @SQL;

 

   FETCH NEXT FROM table_cursor INTO @TableName;

END

 

CLOSE table_cursor;

DEALLOCATE table_cursor;

 

-- Select the results

SELECT *

FROM #StatsUpdateInfo;

 

-- Drop the temporary table

DROP TABLE #StatsUpdateInfo;

 

SSRS Logs On Prem

 Open the below folder to check the SSRS error on the on prem server

c:\program files\Microsoft sql server reporting services\ssrs\logfiles

Wednesday, 14 May 2025

Command Checker for model-app ribbons

 To enable Command Checker, pass ribbondebug=true as a URL parameter (ex: https://myorg.crm.dynamics.com/main.aspx?appid=c26d1c44-e7c0-4c72-9d6d-0e82768cb5bd&ribbondebug=true).  You’ll see two new UI features light up.  The first is a new button in the top right of the header which lets you inspect the global command bar


Introducing Command Checker for model-app ribbons - Microsoft Power Platform Blog


Monday, 7 April 2025

SQL Server Poor Performance Considerations

  • CPU Bottlenecks
    • High CPU usage may indicate inefficient queries or parallelism issues.
  • Memory Pressure

    • Insufficient memory leads to excessive disk I/O.

  • Disk I/O Bottlenecks

    • Check db data and log disk having very good speed I/O

  • Auto-Grow Settings

    • Default auto-growth may cause frequent interruptions. Use manual sizing where possible.

  • TempDB Configuration

    • Too few data files, contention on metadata, or slow disks can all cause issues.

  • Long-Running Transactions

    • Hold locks too long, blocking others.

  • Inappropriate Isolation Levels

    • SERIALIZABLE or REPEATABLE READ can increase blocking unnecessarily.

  • Use of Hints (e.g., NOLOCK)

    • May reduce blocking but introduce dirty reads.

  • CPU: Look for sustained high usage. Check for long-running queries or parallelism issues.

  • Memory: CRM is memory intensive. Ensure SQL Server has sufficient RAM and isn't competing with other services.

  • Disk: Place TempDB, logs, and data files on separate high-speed drives.

    • SQL Server Log file having enough space
    • SQL server data file having enough space

Monday, 27 January 2025

Microsoft 365 URLs and IP address ranges

 To whitelist IP addresses or URLs on the server for Microsoft applications.


Microsoft 365 URLs and IP address ranges - Microsoft 365 Enterprise | Microsoft Learn

Convert Managed Solution to UnManaged Solutions

  1. Run the Below SQL Script

  • DECLARE @solutionId       UNIQUEIDENTIFIER,
            @systemSolutionId UNIQUEIDENTIFIER -- specify the uniquename of the managed solution you'd like to unmanage here it is StagingOrg

    SELECT @solutionId = solutionid
    FROM   solutionbase
    WHERE  uniquename = 'Your solution name' -- DO NOT TOUCH FROM HERE ON --

    SELECT @systemSolutionId = solutionid
    FROM   solutionbase
    WHERE  uniquename = 'Active'

    UPDATE publisherbase
    SET    isreadonly = 0
    WHERE  publisherid IN (SELECT publisherid
                           FROM   solutionbase
                           WHERE  solutionid = @solutionId)

    PRINT 'updated publisher'

    DECLARE @tables TABLE
      (
         id         INT IDENTITY,
         NAME       NVARCHAR(100),
         ismanaged  BIT,
         issolution BIT
      )
    DECLARE @count        INT,
            @currentTable NVARCHAR(100),
            @currentM     BIT,
            @currentS     BIT,
            @sql          NVARCHAR(max) -- go through all the tables that have the ismanaged/solutionid flag, find the related records for the current solution and move them to the crm active solution.

    INSERT INTO @tables
                (NAME,
                 ismanaged,
                 issolution)
    SELECT NAME,
           1,
           0
    FROM   sysobjects
    WHERE  id IN (SELECT id
                  FROM   syscolumns
                  WHERE  NAME IN ( 'IsManaged' ))
           AND type = 'U'
    ORDER  BY NAME

    INSERT INTO @tables
                (NAME,
                 ismanaged,
                 issolution)
    SELECT NAME,
           0,
           1
    FROM   sysobjects
    WHERE  id IN (SELECT id
                  FROM   syscolumns
                  WHERE  NAME IN ( 'SolutionId' ))
           AND type = 'U'
           AND NAME NOT IN ( 'SolutionComponentBase' )
           AND NAME NOT LIKE '%ribbon%' -- ignore this table because it doesn't make a difference. it does cause dependency errors on the exported solution but we can manually edit the xml for that. order by name

    SELECT @count = Count(*)
    FROM   @tables

    WHILE ( @count > 0 )
      BEGIN
          SELECT @currentTable = NAME,
                 @currentM = ismanaged,
                 @currentS = issolution
          FROM   @tables
          WHERE  id = @count

          IF ( @currentM = 1 )
            BEGIN
                SELECT @sql = 'update ' + @currentTable
                              + ' set IsManaged=0 where SolutionId=N'''
                              + Cast( @solutionId AS NVARCHAR(100) ) + ''''

                EXEC (@sql)

                PRINT 'updated IsManaged to 0 on: '
                      + @currentTable
            END

          IF ( @currentS = 1 )
            BEGIN
                SELECT @sql = 'update ' + @currentTable
                              + ' set SolutionId=N'''
                              + Cast( @systemSolutionId AS NVARCHAR(100) )
                              + ''' where SolutionId=N'''
                              + Cast( @solutionId AS NVARCHAR(100) ) + ''''

                EXEC (@sql)

                PRINT 'updated SolutionId on: ' + @currentTable
            END

          SELECT @count = @count - 1,
                 @currentTable = NULL
      END 


    1. Go to Settings > Customizations > Solutions

    2. Export the Solution as Unmanaged

    3. Save and Extract the Solution File

    4. Open and Edit the solution.xml File

    5. Change the <Managed> Tag
      Find the <Managed> tag within the solution.xml file, Change the value from 1 (Managed) to 0 (Unmanaged):

    6. Remove All MissingDependency Elements
      Scroll down towards the bottom of the solution.xml file, Remove all <MissingDependency> elements or self-close them like this:

    7. Re-Zip the Content

    8. Import the Solution Back into CRM