add cli to deploy, add script to cli

This commit is contained in:
chrisjlin 2024-10-02 15:19:48 -07:00
parent 68652351a1
commit baf2c9c489
3 changed files with 82 additions and 70 deletions

View File

@ -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 ## 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. 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. 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. 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. 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. 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 ## Next step
> [!div class="nextstepaction"] > [!div class="nextstepaction"]

View File

@ -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 ## 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. 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. 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. 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"`. 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`. - 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. 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 ## Next step
> [!div class="nextstepaction"] > [!div class="nextstepaction"]
> [Verify cache node functionality](mcc-ent-verify-cache-node.md) > [Verify cache node functionality](mcc-ent-verify-cache-node.md)
<!-- OR -->
## Related content ## Related content
- [Deploy to a Linux host machine](mcc-ent-deploy-to-linux.md) - [Deploy to a Linux host machine](mcc-ent-deploy-to-linux.md)

View File

@ -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. Save the resulting values for cacheNodeId, customerKey, mccResourceId, registrationKey. These GUIDs are needed to create the provisioning script.
### 7. Deploy cache node ### Example script:
<br> 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 <!--# [Bash](#tab/bash)
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)
Use the following link to download and extract the Linux-compatible MCCE provisioning package onto the host machine. :::code language="azurecli" source="~/azure_cli_scripts/azure-cli/create-azure-resources-at-scale/bash/create-azure-resources-at-scale.sh" id="step4":::
[Download MCCE provisioning package for Linux host machine](https://aka.ms/MCC-Ent-InstallScript-Linux) In your console output, are you missing the last row in your CSV file? This can be caused by a missing line continuation character after the last line. Add a blank line at the end of your CSV file to fix the issue.
<br> # [PowerShell](#tab/powershell)
>[!IMPORTANT] :::code language="azurecli" source="~/azure_cli_scripts/azure-cli/create-azure-resources-at-scale/powershell/create-azure-resources-at-scale.ps1" id="step4":::
>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 -->
sudo chmod +x provisionmcc.sh
# [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.<br>
```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
```
<br>
>[!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)
<br>
>[!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.<br>
```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
```
<br>
>[!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.<br>
```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
```
<br>
>[!IMPORTANT]
>'shoulduseproxy' parameter is required, whether or not your network uses proxy to access internet.
## Next step ## Next step
To verify cache node functionality, see [Verify cache node functionality](mcc-ent-verify-cache-node.md) > [!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)
<br>
<br>
### Sample script:
Below is a pseudo code that shows how the above can be scripted for bulk creation and configuration of cache node.