From 5439d21259d0e1a4a3565d12290a1ec138927a51 Mon Sep 17 00:00:00 2001 From: "Alexander (Sasha) Nosov" Date: Thu, 1 May 2025 12:10:43 -0700 Subject: [PATCH] Added cloud shell --- .../manage-payg-transition/README.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/samples/manage/azure-arc-enabled-sql-server/manage-payg-transition/README.md b/samples/manage/azure-arc-enabled-sql-server/manage-payg-transition/README.md index 4d3f60e8..547d0646 100644 --- a/samples/manage/azure-arc-enabled-sql-server/manage-payg-transition/README.md +++ b/samples/manage/azure-arc-enabled-sql-server/manage-payg-transition/README.md @@ -87,3 +87,59 @@ Switch all machines to pay-as-you-go in *all* subscriptions on May 1, 2025 at 0: -AutomationAccount MyAutomation -Location "EastUS" ``` +# Running the script using Cloud Shell + +This option is recommended because Cloud shell has the Azure PowerShell modules pre-installed and you are automatically authenticated. Use the following steps to run the script in Cloud Shell. + +1. Launch the [Cloud Shell](https://shell.azure.com/). For details, [read more about PowerShell in Cloud Shell](https://aka.ms/pscloudshell/docs). + +1. Connect to Azure AD. You must specify `` if you have access to more than one AAD tenants. + + ```console + Connect-AzureAD -TenantID + ``` + +1. Upload the script to your cloud shell using the following command: + + ```console + curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/manage-payg-transition/manage-payg-transition.ps1 -o manage-payg-transition.ps1 + ``` + +1. Run the script. + +> [!NOTE] +> - To paste the commands into the shell, use `Ctrl-Shift-V` on Windows or `Cmd-v` on MacOS. +> - The script will be uploaded directly to the home folder associated with your Cloud Shell session. + +# Running the script from a PC + + +Use the following steps to run the script in a PowerShell session on your PC. + +1. Copy the script to your current folder: + + ```console + curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/manage-payg-transition/manage-payg-transition.ps1 -o manage-payg-transition.ps1 + ``` + +1. Make sure the NuGet package provider is installed: + + ```console + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + Install-packageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Scope CurrentUser -Force + ``` + +1. Make sure the the Az module is installed. For more information, see [Install the Azure Az PowerShell module](https://learn.microsoft.com/powershell/azure/install-az-ps): + + ```console + Install-Module Az -Scope CurrentUser -Repository PSGallery -Force + ``` + +1. Connect to Azure AD and log in to your Azure account. You must specify `` if you have access to more than one AAD tenants. + + ```console + Connect-AzureAD -TenantID + Connect-AzAccount -TenantID (Get-AzureADTenantDetail).ObjectId + ``` + +1. Run the script.