Skip to content

Add host level script to disable ESU,. Automatic Updates, and BPA#1363

Merged
uc-msft merged 4 commits intomicrosoft:masterfrom
charmainewkchan:master
Nov 19, 2024
Merged

Add host level script to disable ESU,. Automatic Updates, and BPA#1363
uc-msft merged 4 commits intomicrosoft:masterfrom
charmainewkchan:master

Conversation

@charmainewkchan
Copy link
Copy Markdown

@charmainewkchan charmainewkchan commented Nov 18, 2024

This script will prompt for the subscription ID and resource group where the user would like to disable ESU, Automatic Updates, and BPA on the Compute Machine - Azure Arc. This script will check for SQL Server Instances in this resource group and run through all the host machines of those instances. It will only send a PATCH request if the machine is connected and if the extension has reported a Healthy status within 24 hours.

You can dry run this script as well.

Command:
.\Patch-ComputeMachineDisableFeatures.ps1 -subscriptionId {subscription ID} -resourceGroupName {resource group} -whatif $false

@@ -0,0 +1,128 @@
$subscriptionId = ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charmainewkchan should script be parameterized, as individual value checks are present already on top of script.
something like :
param (
[string]$subscriptionId,
[string]$resourceGroupName,
[bool]$whatIf = $false
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and RGName could be Parameter(Mandatory=$false) too..

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thanks, updated


$query = @"
Resources
| where type == 'microsoft.azurearcdata/sqlserverinstances'
Copy link
Copy Markdown

@shagunt shagunt Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this ARG query initially i added to find SqlInstances, and from the instances, basically get the HybridComputeResource Id but at that time it was supposed to be a single script for both instance level and host level settings change.
Now since it is only host level, can it be changed to query just hybrid compute machine ( from Sasha's script)
@charmainewkchan https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1#177

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it like this so we only change machines with SQL Server Instances, because we don't have to patch if they don't have our extension.

@charmainewkchan charmainewkchan marked this pull request as ready for review November 19, 2024 20:24
@uc-msft uc-msft merged commit 8941a60 into microsoft:master Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants