Skip to content

Commit 77df1d7

Browse files
author
naman-msft
committed
updated and fixed all docs
1 parent d169e1b commit 77df1d7

File tree

17 files changed

+1472
-442
lines changed

17 files changed

+1472
-442
lines changed

execution_log.csv

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Timestamp,Type,Input,Output,Number of Attempts,Errors Encountered,Execution Time (in seconds),Success/Failure
2+
2025-01-30 15:39:46,file,scenarios/ConfigurePythonContainer/configure-python-container.md,converted_configure-python-container.md,11,"time=2025-01-30T15:26:28-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 0.
3+
Error: command exited with 'exit status 3' and the message 'ERROR: (ResourceGroupNotFound) Resource group 'MyResourceGroup' could not be found.
4+
Code: ResourceGroupNotFound
5+
Message: Resource group 'MyResourceGroup' could not be found.
6+
'
7+
StdErr: ERROR: (ResourceGroupNotFound) Resource group 'MyResourceGroup' could not be found.
8+
Code: ResourceGroupNotFound
9+
Message: Resource group 'MyResourceGroup' could not be found.
10+
11+
time=2025-01-30T15:26:53-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 1.
12+
Error: command exited with 'exit status 3' and the message 'ERROR: (ResourceNotFound) The Resource 'Microsoft.Web/sites/MyPythonAppa47379' under resource group 'MyResourceGroupa47379' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
13+
Code: ResourceNotFound
14+
Message: The Resource 'Microsoft.Web/sites/MyPythonAppa47379' under resource group 'MyResourceGroupa47379' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
15+
'
16+
StdErr: ERROR: (ResourceNotFound) The Resource 'Microsoft.Web/sites/MyPythonAppa47379' under resource group 'MyResourceGroupa47379' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
17+
Code: ResourceNotFound
18+
Message: The Resource 'Microsoft.Web/sites/MyPythonAppa47379' under resource group 'MyResourceGroupa47379' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
19+
20+
time=2025-01-30T15:28:05-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 3.
21+
Error: json: cannot unmarshal string into Go value of type map[string]interface {}
22+
StdErr:
23+
24+
time=2025-01-30T15:29:16-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 3.
25+
Error: json: cannot unmarshal string into Go value of type map[string]interface {}
26+
StdErr:
27+
28+
time=2025-01-30T15:30:54-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 3.
29+
Error: json: cannot unmarshal string into Go value of type map[string]interface {}
30+
StdErr:
31+
32+
time=2025-01-30T15:32:31-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 5.
33+
Error: json: cannot unmarshal array into Go value of type map[string]interface {}
34+
StdErr:
35+
36+
time=2025-01-30T15:33:57-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 5.
37+
Error: json: cannot unmarshal array into Go value of type map[string]interface {}
38+
StdErr:
39+
40+
time=2025-01-30T15:35:31-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 5.
41+
Error: json: cannot unmarshal array into Go value of type map[string]interface {}
42+
StdErr:
43+
44+
time=2025-01-30T15:36:46-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 3.
45+
Error: json: cannot unmarshal string into Go value of type map[string]interface {}
46+
StdErr:
47+
48+
time=2025-01-30T15:38:05-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 3.
49+
Error: json: cannot unmarshal string into Go value of type map[string]interface {}
50+
StdErr:
51+
52+
time=2025-01-30T15:39:46-08:00 level=error msg=Error testing scenario: failed to execute code block 0 on step 6.
53+
Error: json: cannot unmarshal array into Go value of type map[string]interface {}
54+
StdErr: WARNING: App settings have been redacted. Use `az webapp/logicapp/functionapp config appsettings list` to view.",813.0473608970642,Failure

scenarios/ConfigurePythonContainer/configure-python-container.md

Lines changed: 142 additions & 386 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: pg-app
5+
spec:
6+
replicas: 2
7+
selector:
8+
matchLabels:
9+
app: pg-app
10+
template:
11+
metadata:
12+
labels:
13+
app: pg-app
14+
spec:
15+
containers:
16+
- name: pg-app
17+
image: postgres:11
18+
env:
19+
- name: POSTGRES_DB
20+
value:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: pg-app-service
5+
spec:
6+
type: LoadBalancer
7+
ports:
8+
- port: 5432
9+
targetPort: 5432
10+
selector:
11+
app: pg-app

scenarios/DeployHAPGOnAKSTerraform/deploy-ha-pg-on-aks-terraform.md

Lines changed: 63 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,44 @@ In this guide, you will deploy a highly-available PostgreSQL cluster that spans
1414

1515
## Installing Terraform
1616

17-
1. Update Package Index
18-
Before installing any software, it’s a good practice to update your package index. This ensures that you have the latest information about available packages
19-
20-
```bash
21-
sudo apt-get update
22-
```
23-
24-
25-
2. Install Required Packages
26-
You need wget to download files from the internet and unzip to extract the downloaded files. Install them using the following command:
27-
28-
```bash
29-
sudo apt-get install -y wget unzip
30-
```
31-
32-
3317
3. Download Terraform
3418
Use wget to download the latest version of Terraform. You can find the latest version on the Terraform releases page. For example, to download version 1.5.0:
3519

3620
```bash
37-
wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip
21+
if ! command -v terraform &> /dev/null
22+
then
23+
wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip
24+
fi
3825
```
3926

4027
4. Unzip the Downloaded File
4128
After downloading, you need to extract the Terraform binary from the zip file:
4229

4330
```bash
44-
unzip terraform_1.5.0_linux_amd64.zip
31+
if ! command -v terraform &> /dev/null
32+
then
33+
unzip terraform_1.5.0_linux_amd64.zip
34+
fi
4535
```
4636

4737

4838
5. Move Teffaform to a Directory in Your PATH
4939
To make Terraform accessible from anywhere in your terminal, move it to /usr/local/bin:
5040

5141
```bash
52-
sudo mv terraform /usr/local/bin/
42+
if ! command -v terraform &> /dev/null
43+
then
44+
# Create a bin directory in your home directory if it doesn't exist
45+
mkdir -p $HOME/bin
46+
47+
# Move Terraform to the bin directory in your home directory
48+
mv terraform $HOME/bin/
49+
50+
# Add the bin directory to your PATH if it's not already included
51+
if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
52+
export PATH="$HOME/bin:$PATH"
53+
fi
54+
fi
5355
```
5456

5557

@@ -71,18 +73,41 @@ Terraform v1.5.0
7173

7274
1. Create a Terraform Configuration File Create a file named main.tf with the following content:
7375

76+
```bash
77+
# Generate a random suffix
78+
export RANDOM_SUFFIX=$(openssl rand -hex 4)
79+
export RESOURCE_GROUP_NAME="pg-ha-rg$RANDOM_SUFFIX"
80+
export AKS_CLUSTER_NAME="pg-ha-aks$RANDOM_SUFFIX"
81+
export POSTGRES_SERVER_NAME="pg-ha-server$RANDOM_SUFFIX"
82+
export POSTGRES_DATABASE_NAME=$POSTGRES_DATABASE_NAME
83+
export POSTGRES_DATABASE_PASSWORD=$(openssl rand -base64 32)
84+
export POSTGRES_DATABASE_USER="pgadmin$RANDOM_SUFFIX"
85+
86+
# Get the subscription ID programmatically
87+
export TF_VAR_subscription_id=$(az account show --query id --output tsv)
88+
89+
# Set additional environment variables for Terraform
90+
export TF_VAR_resource_group_name=$RESOURCE_GROUP_NAME
91+
export TF_VAR_location="East US"
92+
export TF_VAR_aks_cluster_name=$AKS_CLUSTER_NAME
93+
export TF_VAR_postgres_server_name=$POSTGRES_SERVER_NAME
94+
export TF_VAR_postgres_database_name=$POSTGRES_DATABASE_NAME
95+
export TF_VAR_postgres_database_user=$POSTGRES_DATABASE_USER
96+
export TF_VAR_postgres_database_password=$POSTGRES_DATABASE_PASSWORD
97+
```
98+
7499
```text
75100
provider "azurerm" {
76101
features {}
77102
}
78103
79104
resource "azurerm_resource_group" "rg" {
80-
name = "pg-ha-rg"
105+
name = $RESOURCE_GROUP_NAME
81106
location = "West Europe"
82107
}
83108
84109
resource "azurerm_kubernetes_cluster" "aks" {
85-
name = "pg-ha-aks"
110+
name = $AKS_CLUSTER_NAME
86111
location = azurerm_resource_group.rg.location
87112
resource_group_name = azurerm_resource_group.rg.name
88113
dns_prefix = "pgha"
@@ -105,7 +130,7 @@ resource "azurerm_kubernetes_cluster" "aks" {
105130
}
106131
107132
resource "azurerm_postgresql_server" "pg_server" {
108-
name = "pg-ha-server"
133+
name = $POSTGRES_SERVER_NAME
109134
resource_group_name = azurerm_resource_group.rg.name
110135
location = azurerm_resource_group.rg.location
111136
version = "11"
@@ -117,13 +142,13 @@ resource "azurerm_postgresql_server" "pg_server" {
117142
storage_profile {
118143
storage_mb = 5120
119144
}
120-
administrator_login = "pgadmin"
121-
administrator_login_password = "YourPassword123!"
145+
administrator_login = $POSTGRES_DATABASE_USER
146+
administrator_login_password = $POSTGRES_DATABASE_PASSWORD
122147
ssl_enforcement_enabled = true
123148
}
124149
125150
resource "azurerm_postgresql_database" "pg_database" {
126-
name = "mydatabase"
151+
name = $POSTGRES_DATABASE_NAME
127152
resource_group_name = azurerm_resource_group.rg.name
128153
server_name = azurerm_postgresql_server.pg_server.name
129154
charset = "UTF8"
@@ -211,7 +236,7 @@ Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
211236
6. Verify the Deployment Check the status of the AKS cluster:
212237

213238
```bash
214-
az aks show --resource-group pg-ha-rg --name pg-ha-aks --output table
239+
az aks show --resource-group $RESOURCE_GROUP_NAME --name $AKS_CLUSTER_NAME --output table
215240
```
216241

217242
Results:
@@ -226,7 +251,7 @@ pg-ha-aks pg-ha-rg West Europe 1.20.7 Succeeded
226251
7. Connect to PostgreSQL To connect to your PostgreSQL server, you can use the following command:
227252

228253
```bash
229-
psql "host=pg-ha-server.postgres.database.azure.com dbname=mydatabase user=pgadmin@pg-ha-server password=YourPassword123! sslmode=require"
254+
psql "host=$POSTGRES_SERVER_NAME.postgres.database.azure.com dbname=$POSTGRES_DATABASE_NAME user=$POSTGRES_DATABASE_USER@$POSTGRES_SERVER_NAME password=$POSTGRES_DATABASE_PASSWORD sslmode=require"
230255
```
231256

232257
Results:
@@ -311,7 +336,17 @@ Wait a few moments until the EXTERNAL-IP is assigned. It may take a couple of mi
311336
3. Connect to the Application Once the external IP is assigned, you can connect to the PostgreSQL database using the following command. Replace <EXTERNAL-IP> with the actual external IP address you obtained from the previous step:
312337

313338
```bash
314-
psql "host=<EXTERNAL-IP> dbname=mydatabase user=pgadmin@pg-ha-server password=YourPassword123! sslmode=require"
339+
# Fetch the external IP address
340+
export EXTERNAL_IP=$(kubectl get services pg-app-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
341+
342+
# Check if the EXTERNAL_IP is not empty
343+
if [ -z "$EXTERNAL_IP" ]; then
344+
echo "Error: External IP address not found. Please wait a few moments and try again."
345+
exit 1
346+
fi
347+
348+
# Connect to the PostgreSQL database
349+
psql "host=$EXTERNAL_IP dbname=mydatabase user=pgadmin@pg-ha-server password=YourPassword123! sslmode=require"
315350
```
316351

317352
Results:

scenarios/DeployHAPGOnAKSTerraform/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
provider "azurerm" {
22
features {}
3-
subscription_id = "325e7c34-99fb-4190-aa87-1df746c67705"
3+
subscription_id = var.subscription_id
44
}
55

66
resource "azurerm_resource_group" "rg" {
7-
name = "pg-ha-rg"
8-
location = "East US"
7+
name = var.resource_group_name
8+
location = var.location
99
}
1010

1111
resource "azurerm_kubernetes_cluster" "aks" {
12-
name = "pg-ha-aks"
12+
name = var.aks_cluster_name
1313
location = azurerm_resource_group.rg.location
1414
resource_group_name = azurerm_resource_group.rg.name
1515
dns_prefix = "pgha"
@@ -26,19 +26,19 @@ resource "azurerm_kubernetes_cluster" "aks" {
2626
}
2727

2828
resource "azurerm_postgresql_server" "pg_server" {
29-
name = "pg-ha-server"
29+
name = var.postgres_server_name
3030
resource_group_name = azurerm_resource_group.rg.name
3131
location = azurerm_resource_group.rg.location
3232
version = "11"
33-
administrator_login = "pgadmin"
34-
administrator_login_password = "YourPassword123!"
33+
administrator_login = var.postgres_database_user
34+
administrator_login_password = var.postgres_database_password
3535
ssl_enforcement_enabled = true
3636
sku_name = "B_Gen5_2"
3737
storage_mb = 5120
3838
}
3939

4040
resource "azurerm_postgresql_database" "pg_database" {
41-
name = "mydatabase"
41+
name = var.postgres_database_name
4242
resource_group_name = azurerm_resource_group.rg.name
4343
server_name = azurerm_postgresql_server.pg_server.name
4444
charset = "UTF8"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
variable "subscription_id" {
2+
description = "Azure Subscription ID"
3+
type = string
4+
}
5+
6+
variable "resource_group_name" {
7+
description = "Resource Group Name"
8+
type = string
9+
}
10+
11+
variable "location" {
12+
description = "Azure Region"
13+
type = string
14+
}
15+
16+
variable "aks_cluster_name" {
17+
description = "AKS Cluster Name"
18+
type = string
19+
}
20+
21+
variable "postgres_server_name" {
22+
description = "PostgreSQL Server Name"
23+
type = string
24+
}
25+
26+
variable "postgres_database_name" {
27+
description = "PostgreSQL Database Name"
28+
type = string
29+
}
30+
31+
variable "postgres_database_user" {
32+
description = "PostgreSQL Database User"
33+
type = string
34+
}
35+
36+
variable "postgres_database_password" {
37+
description = "PostgreSQL Database Password"
38+
type = string
39+
sensitive = true
40+
}

scenarios/DeployPremiumSSDV2/deploy-premium-ssd-v2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ Use the [az disk update](/cli/azure/disk#az-disk-update) command to change the p
236236
The following command adjusts the performance of your disk. Update the values in the command, and then run it:
237237

238238
```azurecli
239-
az disk update --subscription $subscription --resource-group $rgname --name $MY_DISK_NAME --disk-iops-read-write=5000 --disk-mbps-read-write=200
239+
export SUBSCRIPTION_ID=$(az account show --query id --output tsv)
240+
az disk update --subscription $SUBSCRIPTION_ID --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_DISK_NAME --disk-iops-read-write=5000 --disk-mbps-read-write=200
240241
```
241242

242243
# [PowerShell](#tab/azure-powershell)

scenarios/ObtainPerformanceMetricsLinuxSustem/obtain-performance-metrics-linux-system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ az vm run-command invoke --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_
5555

5656
## CPU
5757

58-
### <a id="mpstat"></a>mpstat
58+
### mpstat
5959

6060
The `mpstat` utility is part of the `sysstat` package. It displays per CPU utilization and averages, which is helpful to quickly identify CPU usage. `mpstat` provides an overview of CPU utilization across the available CPUs, helping identify usage balance and if a single CPU is heavily loaded.
6161

0 commit comments

Comments
 (0)