Skip to content

Commit 01a78c5

Browse files
author
naman-msft
committed
updated tools
1 parent c1b4dad commit 01a78c5

File tree

3 files changed

+188
-3
lines changed

3 files changed

+188
-3
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: 'Quickstart: Create a Linux VM and SSH into it'
3+
description: Learn how to create a Linux virtual machine in Azure and SSH into it using Azure CLI commands within an Exec Doc.
4+
ms.topic: quickstart
5+
ms.date: 10/12/2023
6+
author: azureuser123
7+
ms.author: azureuser123
8+
ms.custom: innovation-engine, azurecli, linux-related-content
9+
---
10+
11+
In this Exec Doc, you will learn how to create a Linux virtual machine (VM) in Azure using the Azure CLI and then SSH into the newly created VM. All commands have been configured to run non-interactively. Remember to update any variables if necessary and note that resources are appended with a random suffix to avoid naming conflicts in subsequent runs.
12+
13+
## Step 1: Set Environment Variables
14+
15+
In this step, we declare the environment variables that will be used throughout the Exec Doc. A random suffix is appended to the resource group and VM names to ensure uniqueness.
16+
17+
```bash
18+
export RANDOM_SUFFIX=$(openssl rand -hex 3)
19+
export REGION="WestUS2"
20+
export MY_RESOURCE_GROUP_NAME="MyResourceGroup$RANDOM_SUFFIX"
21+
export MY_VM_NAME="MyLinuxVM$RANDOM_SUFFIX"
22+
```
23+
24+
## Step 2: Create a Resource Group
25+
26+
This step creates a new resource group in the specified region.
27+
28+
```bash
29+
az group create --name $MY_RESOURCE_GROUP_NAME --location $REGION
30+
```
31+
32+
Results:
33+
34+
<!-- expected_similarity=0.3 -->
35+
36+
```JSON
37+
{
38+
"id": "/subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/MyResourceGroupxxxxx",
39+
"location": "WestUS2",
40+
"managedBy": null,
41+
"name": "MyResourceGroupxxxxx",
42+
"properties": {
43+
"provisioningState": "Succeeded"
44+
},
45+
"tags": null,
46+
"type": "Microsoft.Resources/resourceGroups"
47+
}
48+
```
49+
50+
## Step 3: Create a Linux Virtual Machine
51+
52+
Now you will create a Linux VM using the Ubuntu LTS image. The command includes the generation of SSH keys if they do not already exist. The default administrator username is set to "azureuser".
53+
54+
```bash
55+
az vm create --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_NAME --image UbuntuLTS --admin-username azureuser --generate-ssh-keys
56+
```
57+
58+
Results:
59+
60+
<!-- expected_similarity=0.3 -->
61+
62+
```JSON
63+
{
64+
"fqdns": "",
65+
"id": "/subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/MyResourceGroupxxxxx/providers/Microsoft.Compute/virtualMachines/MyLinuxVMxxxxx",
66+
"location": "WestUS2",
67+
"name": "MyLinuxVMxxxxx",
68+
"powerState": "VM running",
69+
"privateIpAddress": "10.0.0.4",
70+
"publicIpAddress": "52.xxx.xxx.xxx"
71+
}
72+
```
73+
74+
## Step 4: Retrieve the VM's Public IP Address
75+
76+
Next, you retrieve the public IP address of the newly created VM. This value is stored in an environment variable for later use in the SSH command.
77+
78+
```bash
79+
export PUBLIC_IP=$(az vm show -d --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_NAME --query publicIps -o tsv)
80+
```
81+
82+
## Step 5: SSH into the VM
83+
84+
Finally, use the SSH command to connect to your Linux VM. The SSH command includes the option to disable strict host key checking to avoid interactive prompts during the first connection.
85+
86+
```bash
87+
ssh -o StrictHostKeyChecking=no azureuser@$PUBLIC_IP
88+
```
89+
90+
This SSH command connects you to the VM using the default administrator account "azureuser". Once connected, you can start managing your Linux environment directly.
91+
92+
Happy learning and exploring your new Linux VM in Azure!
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: 'Quickstart: Create a Linux VM and SSH into it'
3+
description: Learn how to create a Linux virtual machine in Azure and SSH into it using Azure CLI commands within an Exec Doc.
4+
ms.topic: quickstart
5+
ms.date: 10/12/2023
6+
author: azureuser123
7+
ms.author: azureuser123
8+
ms.custom: innovation-engine, azurecli, linux-related-content
9+
---
10+
11+
In this Exec Doc, you will learn how to create a Linux virtual machine (VM) in Azure using the Azure CLI and then SSH into the newly created VM. All commands have been configured to run non-interactively. Remember to update any variables if necessary and note that resources are appended with a random suffix to avoid naming conflicts in subsequent runs.
12+
13+
## Step 1: Set Environment Variables
14+
15+
In this step, we declare the environment variables that will be used throughout the Exec Doc. A random suffix is appended to the resource group and VM names to ensure uniqueness.
16+
17+
```bash
18+
export RANDOM_SUFFIX=$(openssl rand -hex 3)
19+
export REGION="WestUS2"
20+
export MY_RESOURCE_GROUP_NAME="MyResourceGroup$RANDOM_SUFFIX"
21+
export MY_VM_NAME="MyLinuxVM$RANDOM_SUFFIX"
22+
```
23+
24+
## Step 2: Create a Resource Group
25+
26+
This step creates a new resource group in the specified region.
27+
28+
```bash
29+
az group create --name $MY_RESOURCE_GROUP_NAME --location $REGION
30+
```
31+
32+
Results:
33+
34+
<!-- expected_similarity=0.3 -->
35+
36+
```JSON
37+
{
38+
"id": "/subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/MyResourceGroupxxxxx",
39+
"location": "WestUS2",
40+
"managedBy": null,
41+
"name": "MyResourceGroupxxxxx",
42+
"properties": {
43+
"provisioningState": "Succeeded"
44+
},
45+
"tags": null,
46+
"type": "Microsoft.Resources/resourceGroups"
47+
}
48+
```
49+
50+
## Step 3: Create a Linux Virtual Machine
51+
52+
Now you will create a Linux VM using the Ubuntu LTS image. The command includes the generation of SSH keys if they do not already exist. The default administrator username is set to "azureuser".
53+
54+
```bash
55+
az vm create --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_NAME --image UbuntuLTS --admin-username azureuser --generate-ssh-keys
56+
```
57+
58+
Results:
59+
60+
<!-- expected_similarity=0.3 -->
61+
62+
```JSON
63+
{
64+
"fqdns": "",
65+
"id": "/subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/MyResourceGroupxxxxx/providers/Microsoft.Compute/virtualMachines/MyLinuxVMxxxxx",
66+
"location": "WestUS2",
67+
"name": "MyLinuxVMxxxxx",
68+
"powerState": "VM running",
69+
"privateIpAddress": "10.0.0.4",
70+
"publicIpAddress": "52.xxx.xxx.xxx"
71+
}
72+
```
73+
74+
## Step 4: Retrieve the VM's Public IP Address
75+
76+
Next, you retrieve the public IP address of the newly created VM. This value is stored in an environment variable for later use in the SSH command.
77+
78+
```bash
79+
export PUBLIC_IP=$(az vm show -d --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_NAME --query publicIps -o tsv)
80+
```
81+
82+
## Step 5: SSH into the VM
83+
84+
Finally, use the SSH command to connect to your Linux VM. The SSH command includes the option to disable strict host key checking to avoid interactive prompts during the first connection.
85+
86+
```bash
87+
ssh -o StrictHostKeyChecking=no azureuser@$PUBLIC_IP
88+
```
89+
90+
This SSH command connects you to the VM using the default administrator account "azureuser". Once connected, you can start managing your Linux environment directly.
91+
92+
Happy learning and exploring your new Linux VM in Azure!

tools/ada.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,8 @@ def generate_title_from_description(description):
10451045
title = response.choices[0].message.content.strip()
10461046
# Remove any quotes, backticks or other formatting that might be included
10471047
title = title.strip('"\'`')
1048-
print_message(f"\nGenerated title: {title}")
1048+
print_header(f"Title: {title}", "=")
1049+
10491050
return title
10501051
except Exception as e:
10511052
print_message(f"\nError generating title: {e}")
@@ -1226,7 +1227,7 @@ def analyze_user_intent(user_input, input_type):
12261227
intent = response.choices[0].message.content.strip()
12271228
# Remove any quotes or formatting
12281229
intent = intent.strip('"\'`')
1229-
print_message(f"\nDetected user intent: {intent}")
1230+
print_message(f"User intent: {intent}", "-")
12301231
return intent
12311232
except Exception as e:
12321233
print_message(f"\nError analyzing user intent: {e}")
@@ -1916,7 +1917,7 @@ def main():
19161917
remove_backticks_from_file(output_file)
19171918

19181919
print_header(f"Running Innovation Engine tests...", "-")
1919-
1920+
19201921
try:
19211922
result = subprocess.run(["ie", "test", output_file], capture_output=True, text=True, timeout=660)
19221923
except subprocess.TimeoutExpired:

0 commit comments

Comments
 (0)