From baf2c9c48928a81a8ab45348fef477ff88aa8ee6 Mon Sep 17 00:00:00 2001 From: chrisjlin <36452239+chrisjlin@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:19:48 -0700 Subject: [PATCH] add cli to deploy, add script to cli --- .../deployment/do/mcc-ent-deploy-to-linux.md | 20 ++++ .../do/mcc-ent-deploy-to-windows.md | 26 ++++- .../do/mcc-ent-manage-cache-using-CLI.md | 106 +++++++----------- 3 files changed, 82 insertions(+), 70 deletions(-) diff --git a/windows/deployment/do/mcc-ent-deploy-to-linux.md b/windows/deployment/do/mcc-ent-deploy-to-linux.md index 09601b0e3e..94123f7d51 100644 --- a/windows/deployment/do/mcc-ent-deploy-to-linux.md +++ b/windows/deployment/do/mcc-ent-deploy-to-linux.md @@ -21,12 +21,32 @@ Before deploying MCCE to a Linux host machine, ensure that the host machine meet ## Steps to deploy MCCE cache node to Linux +# [Azure portal](#tab/portal) + 1. Within the Azure portal, navigate to the "Provisioning" tab of your cache node and copy the provisioning command. 1. Download the provisioning package using the button at the top of the Cache Node Configuration page and extract the package onto the host machine. 1. Open a command line window *as administrator* on the host machine, then change directory to the extracted provisioning package. 1. Set access permissions to allow the `provisionmcc.sh` script within the provisioning package directory to execute. 1. Run the provisioning command on the host machine. +# [Azure CLI](#tab/cli) + +To deploy a cache node programmatically, you'll need to use Azure CLI to get the cache node's provisioning details and then run the provisioning command on the host machine. + +1. To get the cache node's provisioning details, use `az mcc ent node get-provisioning-details` + ```azurecli-interactive + az mcc ent node get-provisioning-details --cache-node-name mycachenode --mcc-resource-name mymccresource --resource-group myrg + ``` +1. Save the resulting output. These values will be passed as parameters within the provisioning command. +1. Download and extract the [MCCE provisioning package for Linux](https://aka.ms/MCC-Ent-InstallScript-Linux) to your host machine. +1. Open a command line window *as administrator* on the host machine, then change directory to the extracted provisioning package. +1. Set access permissions to allow the `provisionmcc.sh` script within the provisioning package directory to execute. +1. Replace the values in the following provisioning command before running it on the host machine. + +```azurepowershell-interactive +sudo ./provisionmcc.sh customerid="enter mccResourceId here" cachenodeid=" enter cacheNodeId here " customerkey=" enter customerKey here " registrationkey="enter registrationKey here" drivepathandsizeingb="enter physicalPath value,enter sizeInGb value here" shoulduseproxy="enter true if present, enter false if not" proxyurl=http://enter proxy hostname:enter port +``` + ## Next step > [!div class="nextstepaction"] diff --git a/windows/deployment/do/mcc-ent-deploy-to-windows.md b/windows/deployment/do/mcc-ent-deploy-to-windows.md index 7f6e4806b4..2af5db8c44 100644 --- a/windows/deployment/do/mcc-ent-deploy-to-windows.md +++ b/windows/deployment/do/mcc-ent-deploy-to-windows.md @@ -23,21 +23,41 @@ Before deploying MCCE to a Windows host machine, ensure that the host machine me ## Steps to deploy MCCE cache node to Windows +# [Azure portal](#tab/portal) + 1. Within the Azure portal, navigate to the "Provisioning" tab of your cache node and copy the provisioning command. 1. Download the provisioning package using the button at the top of the Cache Node Configuration page and extract the package onto the host machine. -1. Open a PowerShell windows *as administrator* on the host machine, then change directory to the extracted provisioning package. +1. Open a PowerShell window *as administrator* on the host machine, then change directory to the extracted provisioning package. 1. Set the Execution Policy to "Unrestricted" to allow the provisioning scripts to run. 1. Create a `$User` environment variable containing the username of the account you intend to designate as the MCC runtime account. For gMSAs, the value should be formatted as `"Domain\Username$"`. For Local User accounts, `$User` should be formatted as `"LocalMachineName\Username"`. - If you're using a Local User account as the MCCE runtime account, you'll also need to create a [PSCredential Object](https://learn.microsoft.com/dotnet/api/system.management.automation.pscredential?view=powershellsdk-7.4.0&preserve-view=true) named `$myLocalAccountCredential`. 1. Run the provisioning command on the host machine. +# [Azure CLI](#tab/cli) + +To deploy a cache node programmatically, you'll need to use Azure CLI to get the cache node's provisioning details and then run the provisioning command on the host machine. + +1. To get the cache node's provisioning details, use `az mcc ent node get-provisioning-details` + ```azurecli-interactive + az mcc ent node get-provisioning-details --cache-node-name mycachenode --mcc-resource-name mymccresource --resource-group myrg + ``` +1. Save the resulting output. These values will be passed as parameters within the provisioning command. +1. Download and extract the [MCCE provisioning package for Windows](https://aka.ms/MCC-Ent-InstallScript-WSL) to your host machine. +1. Open a PowerShell window *as administrator* on the host machine, then change directory to the extracted provisioning package. +1. Set the Execution Policy to "Unrestricted" to allow the provisioning scripts to run. +1. Create a `$User` environment variable containing the username of the account you intend to designate as the MCC runtime account. For gMSAs, the value should be formatted as `"Domain\Username$"`. For Local User accounts, `$User` should be formatted as `"LocalMachineName\Username"`. + - If you're using a Local User account as the MCCE runtime account, you'll also need to create a [PSCredential Object](https://learn.microsoft.com/dotnet/api/system.management.automation.pscredential?view=powershellsdk-7.4.0&preserve-view=true) named `$myLocalAccountCredential`. +1. Replace the values in the following provisioning command before running it on the host machine. Note that `-mccLocalAccountCredential $myLocalAccountCredential` is only needed if you are using a Local User account as the MCC runtime account. + +```powershell-interactive +./provisionmcconwsl.ps1 -installationFolder c:\mccwsl01 -customerid [enter mccResourceId here] -cachenodeid [enter cacheNodeId here] -customerkey [enter customerKey here] -registrationkey [enter registration key] -cacheDrives "/var/mcc,enter drive size" -shouldUseProxy [enter true if present, enter false if not] -proxyurl "http://[enter proxy host name]:[enter port]" -mccRunTimeAccount $User -mccLocalAccountCredential $myLocalAccountCredential +``` + ## Next step > [!div class="nextstepaction"] > [Verify cache node functionality](mcc-ent-verify-cache-node.md) - - ## Related content - [Deploy to a Linux host machine](mcc-ent-deploy-to-linux.md) diff --git a/windows/deployment/do/mcc-ent-manage-cache-using-CLI.md b/windows/deployment/do/mcc-ent-manage-cache-using-CLI.md index 1f28f0bdbf..da312715ed 100644 --- a/windows/deployment/do/mcc-ent-manage-cache-using-CLI.md +++ b/windows/deployment/do/mcc-ent-manage-cache-using-CLI.md @@ -136,79 +136,51 @@ az mcc ent node get-provisioning-details --cache-node-name mycachenode --mcc-res Save the resulting values for cacheNodeId, customerKey, mccResourceId, registrationKey. These GUIDs are needed to create the provisioning script. -### 7. Deploy cache node -
+### Example script: +Below is a pseudocode example of how to script bulk creation and configuration of an MCC Azure resource and five MCC cache nodes. -#### Deploy cache node to Linux host machine -Before you deploy your cache node to a Linux host machine, make sure you have met the prerequisites listed here: [Host machine requirements](mcc-ent-prerequisites.md) + + +# [PowerShell](#tab/powershell) + +```powershell +#Define variables +$mccResourceName = "demo-01" +$cacheNodeName = "demo-node" +$cacheNodeOperatingSystem = "Windows" +$resourceGroup = "myRG" +$resourceLocation = "westus" +$cacheNodesToCreate = 5 +$proxyHost = "yourProxyHost.com" +$proxyPort = "8080" + +#Create MCC Azure resource +az mcc ent resource create --mcc-resource-name $mccResourceName --location $resourceLocation --resource-group $resourceGroup + +#Create 5 cache nodes +for ($cacheNodeNumber = 1; $cacheNodeNumber -le $cacheNodesToCreate; $cacheNodeNumber++) { + $iteratedCacheNodeName = $cacheNodeName + "-" + $cacheNodeNumber + + #Create cache node + az mcc ent node create --cache-node-name $iteratedCacheNodeName --mcc-resource-name $mccResourceName --host-os $cacheNodeOperatingSystem --resource-group $resourceGroup + + #Configure cache node + az mcc ent node update --cache-node-name $iteratedCacheNodeName --mcc-resource-name $mccResourceName --resource-group $resourceGroup --cache-drive "[{physical-path:/var/mcc,size-in-gb:50}]" --proxy enabled --proxy-host $proxyHost --proxy-port $proxyPort +} ``` -Replace the values in the following provisioning command before running it.
- -```azurepowershell-interactive -sudo ./provisionmcc.sh customerid="enter mccResourceId here" cachenodeid=" enter cacheNodeId here " customerkey=" enter customerKey here " registrationkey="enter registrationKey here" drivepathandsizeingb="enter physicalPath value,enter sizeInGb value here" shoulduseproxy="true" proxyurl=http://enter proxy hostname:enter port -``` -
- ->[!IMPORTANT] ->'shoulduseproxy' parameter is required, whether or not your network uses proxy to access internet. - -#### Deploy cache node to Windows host machine - -Before you deploy your cache node to a Windows host machine, make sure you have met the prerequisites listed here: [Host machine requirements](mcc-ent-prerequisites.md) - -Use the following link to download and extract the Windows-compatible MCCE provisioning package onto the host machine. -[Download MCCE provisioning package for Windows host machine](https://aka.ms/MCC-Ent-InstallScript-WSL) -
- ->[!IMPORTANT] ->Before you execute the provisioning command, make sure you change directory to the extracted provisioning package and set the script execution permissions by running the command below. -```azurepowershell-interactive -Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -``` - -If you're using a **Group Managed Service Account**, replace the values in the following provisioning command before running it.
- -```powershell-interactive -./provisionmcconwsl.ps1 -installationFolder c:\mccwsl01 -customerid enter mccResourceId here -cachenodeid enter cacheNodeId here -customerkey enter customerKey here -registrationkey enter registration key -cacheDrives "/var/mcc,enter drive size" -shouldUseProxy $true -proxyurl " http://enter proxy host name:enter port" -mccRunTimeAccount $User -``` - -
- ->[!IMPORTANT] ->'shoulduseproxy' parameter is required, whether or not your network uses proxy to access internet. - -If you're using **Local User account** or **Domain User account**, replace the values in the following provisioning command before running it.
- -```powershell-interactive -./provisionmcconwsl.ps1 -installationFolder c:\mccwsl01 -customerid enter mccResourceId here -cachenodeid enter cacheNodeId here -customerkey enter customerKey here -registrationkey enter registration key -cacheDrives "/var/mcc,enter drive size" -shouldUseProxy $true -proxyurl " http://enter proxy host name:enter port" -mccRunTimeAccount $User -mccLocalAccountCredential $myLocalAccountCredential -``` - -
- ->[!IMPORTANT] ->'shoulduseproxy' parameter is required, whether or not your network uses proxy to access internet. - - ## Next step -To verify cache node functionality, see [Verify cache node functionality](mcc-ent-verify-cache-node.md) - - -
-
- -### Sample script: -Below is a pseudo code that shows how the above can be scripted for bulk creation and configuration of cache node. - +> [!div class="nextstepaction"] +> [Deploy cache node to Linux host machine](mcc-ent-deploy-to-Linux.md) +> [Deploy cache node to Windows host machine](mcc-ent-deploy-to-Windows.md)