In the last excercise we had worked around security measures andmonitoring, so now let's onboard SQL Server to Azure Arc using Azure Portal and PowerShell commands.
-
In the LabVM/ARCHost VM, click on the Azure portal shortcut of Microsoft Edge browser which is present on the desktop.
-
On the Sign in to Microsoft Azure tab, you will see the login screen. Provide the following Email/Username and then click on Next.
- Email/Username:
-
Now enter the following Password and click on Sign in.
- Password:
-
If you see the pop-up Stay Signed in?, click No.
-
If you see the pop-up You have free Azure Advisor recommendations!, close the window to continue the lab.
-
If Welcome to Microsoft Azure pop-up window appears, click on Maybe Later to skip the tour.
-
Click on the search blade at the top and search for
SQL Server
, select SQL Server - Azure Arc. -
Click on the Add button to create the SQL Server- Azure Arc.
-
Now click on the Connect Server button on Connect SQL Server to Azure Arc dialouge box.
-
You will now see the prerequisite page. You can explore the page and then click on the Next: Server details option.
Note: We have already completed the prerequisite part for you.
-
On the Server Details blade, enter the below details.
-
Subscription: Leave default
-
Resource group: Select azure-arc-SUFFIX from dropdown list.
-
Region: Select same region as the Resource group.
-
Operating Systems: Select Windows.
Now click on the Next button.
-
-
Leave the default for tags blade and click on Next: Run Script button.
-
On the Script blade, explore the given script. We will be using this PowerShell script to Register Azure Arc enabled SQL Server later.
Note : You can skip the script download from here. We have already downloaded this script inside the Lab VM for you.
-
From your LabVM/ARCHost VM, open Windows PowerShell icon from the desktop.
-
Then, run the below command to change the directory to where the script gets downloaded.
cd C:\LabFiles
-
After changing the directory to Lab files, run the command given below:
.\Execute-RegisterSqlServerArc.ps1
Note : This will automatically run the RegisterSqlServerArc.ps1 script inside sqlvm deployed on Hyper-V.
-
After running the command, you will see that the script started running.
-
After some time, you will see that the script execution is completed. Make sure that you see the output as shown the image below.
-
Go back to the Azure portal and search for SQL Server -Azure Arc. You will see one resource that we just created using the PowerShell script in the previous step.
-
Select the SQLVM resource and now you can see the dashboard of SQLVM SQL Server -Azure Arc from Azure Portal.
-
Search for Log analytics workspace, then select Agents management from the left side menu and copy the value of Workspace ID and Primary Key and save it into a notepad for later use.
-
Now, search for Servers - Azure Arc from search box and click on Servers - Azure Arc.
-
Select sqlvm from the list of Azure Arc servers.
-
Click on the Extension button from the left side menu and click on the Add button to add a new extension.
-
Select the Log Analytics Agent - Azure Arc extension.
-
Now click on the Create button to continue.
-
At this step, you must enter Log analytics workspace ID and a key to install the MMA in the sqlvm.
-
Now, enter the Workspace ID and Key that you copied from the previous step, and click on Review + Create button and then click on Create on next window.
After a few minutes, the deployment will complete and you can continue with the next task.
-
Go to SQLVM Azure Arc - SQL Server resource and select the Environment Health under settings from the left side menu.
Now select the below details:
- Account Type: Select Domain User Account from the drop-down menu.
Then click on the Download configuration Script button to download the PowerShell script.
-
Here you will see one PowerShell script is downloaded.
-
Open the PowerShell by clicking on the Windows Powershell from your LABVM Desktop and run this command to copy this script in the sqlvm machine.
Copy-VMFile "sqlvm" -SourcePath "C:\Users\arcadmin\Downloads\AddSqlAssessment.ps1" -DestinationPath "C:\LabFiles\AddSqlAssessment.ps1" -CreateFullPath -FileSource Host
-
After the command is successfully completed, open sqlvm from the Hyper-V Manager with double click on sqlvm.
-
On Connect to sqlvm box scroll the bar towards teh small to open the vm in smallest window and then click on Connect button.
-
Enter password demo@pass123 and press Enter button to login. Then, you can resize the sqlvm window size as per confort.
-
Click on Start Menu and search for SQL Server 2019 Configuration Manger and open SQL Server 2019 Configuration Manger.
-
Now Select SQL Server Network configuration and Double click on Protocol for MSSQLSERVER.
-
Now Right click on the TCP/IP and select Enable. You will get one Warning Pop-up select okay on the pop-up.
-
After enabling the TCP/iP port select SQL Server Services from left side menu and right click on SQL Server and select Restart. This will restart the SQL Service and apply the TCP/IP port.
-
Open File explorer in the sqlvm and navigate to *C:\LabFiles* this directory and right-click on AddSqlAssessment.ps1 PowerShell script and select Run with PowerShell to run the PowerShell script to schedule the task which will generate the assessment and logs.
-
Enter the below Schduled Task username and Password on powershell window and press enter to run the scipt.
- SchduledTaskUserName: Administrator
- SchduledTaskPassword: demo@pass123
-
After running the PowerShell script, navigate to C:\sqlserver\SQLAssessment directory in File Explorer, and you will be able to see some files and folders. These are the assessments and logs that are generated using the PowerShell script.
Note : This can take 10 20 minutes to see the folder and logs in this directory.
- Register Azure Arc enabled SQL Server.
- Run on-demand SQL Assessment.