Skip to content

Commit

Permalink
updated authoring tool
Browse files Browse the repository at this point in the history
;
  • Loading branch information
naman-msft committed Dec 18, 2024
1 parent f4d8966 commit 0a9715a
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tools/ada.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,19 @@
>**Note:** We remove commands from this section ***only*** in Exec Docs. This is because Innovation Engine executes all relevant command(s) that it encounters, inlcuding deleting the resources. That would be counterproductive to automated deployment of cloud infrastructure
13. DON'T START AND END YOUR ANSWER WITH ``` BACKTICKS!!!
13. DON'T START AND END YOUR ANSWER WITH ``` BACKTICKS!!! DON'T ADD ``` BACKTICKS TO THE METADATA AT THE TOP!!!
14. ENSURE THE DETAIL AND MESSAGING IN THE ORIGINAL DOC REMAINS. ONLY MODIFY THE CONTENT WITHIN CODE BLOCKS IF A CORRECTION OR UPDATE IS NECESSARY, AND DO NOT ALTER OR REMOVE ANY NON-CODE CONTENT OUTSIDE THE CODE BLOCKS. PRESERVE FORMATTING, COMMENTS, SPECIAL CHARACTERS (E.G., ARROWS, BRACKETS, OR QUOTED TEXT), AND ANY DESCRIPTIVE CONTENT EXACTLY AS IT APPEARS.
14. **DO NOT MODIFY ANY TEXT OUTSIDE OF CODE BLOCKS.**
1. **ONLY edit the content inside code blocks (marked by triple backticks: ```).**
2. **DO NOT modify, reformat, remove, or add anything outside of the code blocks.**
3. **PRESERVE all text, comments, and special formatting (e.g., brackets, arrows, quoted text, and markdown syntax) exactly as it appears outside of the code blocks.**
4. If no changes are necessary to a code block, leave it as-is.
### **RULES**
- Any deviation from these instructions will be considered incorrect.
- Leave non-code content untouched, no matter what.
- Modify code blocks minimally, only if necessary, and document your changes in the code as comments.
## WRITE AN EXEC DOC USING THE ABOVE RULES FOR THE FOLLOWING WORKLOAD: """

Expand Down Expand Up @@ -291,6 +301,14 @@ def remove_backticks_from_file(file_path):
if lines and "```" in lines[-1]:
lines = lines[:-1]

# Remove backticks before and after the metadata section
if lines and "---" in lines[0]:
for i in range(1, len(lines)):
if "---" in lines[i]:
if "```" in lines[i + 1]:
lines = lines[:i + 1] + lines[i + 2:]
break

with open(file_path, "w") as f:
f.writelines(lines)

Expand Down
157 changes: 157 additions & 0 deletions tools/converted_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
title: 'Tutorial: Create & manage a Virtual Machine Scale Set – Azure CLI'
description: Learn how to use the Azure CLI to create a Virtual Machine Scale Set, along with some common management tasks such as how to start and stop an instance, or change the scale set capacity.
ms.topic: tutorial
ms.date: 06/14/2024
author: ju-shim
ms.author: jushiman
ms.custom: innovation-engine, mimckitt, devx-track-azurecli
---
```
# Tutorial: Create and manage a Virtual Machine Scale Set with the Azure CLI
```bash
# Section: Create a Resource Group
# Random suffix ensures uniqueness for resource group names; corrected consistent use of variable
export RANDOM_SUFFIX=$(openssl rand -hex 3)
export REGION="eastus"
export RESOURCE_GROUP_NAME="MyResourceGroup$RANDOM_SUFFIX"
az group create --name $RESOURCE_GROUP_NAME --location $REGION
```

<!-- expected_similarity=0.3 -->

```JSON
{
"id": "/subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/MyResourceGroupXXX",
"location": "eastus",
"managedBy": null,
"name": "MyResourceGroupXXX",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
```

---

```bash
# Section: Create a Scale Set
# Updated variable usage for consistency
export SCALE_SET_NAME="MyScaleSet$RANDOM_SUFFIX"
export IMAGE="UbuntuLTS" # Replace with a valid image SKU as needed
export ADMIN_USERNAME="azureuser"

az vmss create \
--resource-group $RESOURCE_GROUP_NAME \
--name $SCALE_SET_NAME \
--orchestration-mode flexible \
--image $IMAGE \
--admin-username $ADMIN_USERNAME \
--generate-ssh-keys
```

<!-- expected_similarity=0.3 -->

```JSON
{
"provisioningState": "Succeeded",
"id": "/subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/MyResourceGroupXXX/providers/Microsoft.Compute/virtualMachineScaleSets/MyScaleSetXXX",
"name": "MyScaleSetXXX",
"type": "Microsoft.Compute/virtualMachineScaleSets",
"location": "eastus",
"properties": {
"orchestrationMode": "Flexible",
"overprovision": false,
"...additional-metadata..."
}
}
```

---

```bash
# Section: List VM Instances in the Scale Set
# Using updated resource group variable
az vm list --resource-group $RESOURCE_GROUP_NAME --output table
```

<!-- expected_similarity=0.3 -->

```text
Name ResourceGroup Location Zones
------------------- ----------------------- ---------- -------
MyScaleSetXXX_instance1 MyResourceGroupXXX eastus
MyScaleSetXXX_instance2 MyResourceGroupXXX eastus
```

---

```bash
# Section: Change the Capacity of the Scale Set
az vmss scale \
--resource-group $RESOURCE_GROUP_NAME \
--name $SCALE_SET_NAME \
--new-capacity 3
```

<!-- expected_similarity=0.3 -->

```JSON
{
"count": 3,
"provisioningState": "Updating"
}
```

---

```bash
# Section: Stop all VM Instances in the Scale Set
az vmss stop \
--resource-group $RESOURCE_GROUP_NAME \
--name $SCALE_SET_NAME
```

---

```bash
# Section: Start all VM Instances in the Scale Set
az vmss start \
--resource-group $RESOURCE_GROUP_NAME \
--name $SCALE_SET_NAME
```

---

```bash
# Section: Restart all VM Instances in the Scale Set
az vmss restart \
--resource-group $RESOURCE_GROUP_NAME \
--name $SCALE_SET_NAME
```

---

```bash
# Section: Deallocate a Specific VM Instance
# Replace <INSTANCE_NAME> with an actual instance name from the scale set
export INSTANCE_NAME="<INSTANCE_NAME>"
az vm deallocate \
--resource-group $RESOURCE_GROUP_NAME \
--name $INSTANCE_NAME
```

---

```bash
# Section: Delete the Resource Group
# Resource group deletion, which removes all associated resources, is demonstrated but commented out for safety
# az group delete --name $RESOURCE_GROUP_NAME --no-wait --yes
```

By following this guide, you can easily create, manage, and perform basic operations on a Virtual Machine Scale Set using the Azure CLI.

0 comments on commit 0a9715a

Please sign in to comment.