Skip to content

Commit 7cbb7df

Browse files
authored
Merge pull request #108377 from TimShererWithAquent/us1669724p
Azure CLI syntax blocks.
2 parents efe8069 + de9d124 commit 7cbb7df

12 files changed

+79
-63
lines changed

articles/virtual-machines/extensions/diagnostics-linux.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The downloadable configuration is just an example; modify it to suit your own ne
5656

5757
Fill in the correct values for the variables in the first section before running:
5858

59-
```bash
59+
```azurecli
6060
# Set your Azure VM diagnostic variables correctly below
6161
my_resource_group=<your_azure_resource_group_name_containing_your_azure_linux_vm>
6262
my_linux_vm=<your_azure_linux_vm_name>
@@ -88,7 +88,7 @@ The URL for the sample configuration, and its contents, are subject to change. D
8888

8989
#### PowerShell sample
9090

91-
```Powershell
91+
```powershell
9292
$storageAccountName = "yourStorageAccountName"
9393
$storageAccountResourceGroup = "yourStorageAccountResourceGroupName"
9494
$vmName = "yourVMName"
@@ -216,7 +216,7 @@ The "sasURL" entry contains the full URL, including SAS token, for the Event Hub
216216

217217
If you created a SAS good until midnight UTC on January 1, 2018, the sasURL value might be:
218218

219-
```url
219+
```https
220220
https://contosohub.servicebus.windows.net/syslogmsgs?sr=contosohub.servicebus.windows.net%2fsyslogmsgs&sig=xxxxxxxxxxxxxxxxxxxxxxxxx&se=1514764800&skn=writer
221221
```
222222

articles/virtual-machines/linux/cloudinit-prepare-custom-image.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ sudo yum install - y cloud-init
2424
```
2525

2626
Update the `cloud_init_modules` section in `/etc/cloud/cloud.cfg` to include the following modules:
27+
2728
```bash
2829
- disk_setup
2930
- mounts
3031
```
3132

3233
Here is a sample of what a general-purpose `cloud_init_modules` section looks like.
34+
3335
```bash
3436
cloud_init_modules:
3537
- migrator
@@ -46,7 +48,9 @@ cloud_init_modules:
4648
- users-groups
4749
- ssh
4850
```
49-
A number of tasks relating to provisioning and handling ephemeral disks need to be updated in `/etc/waagent.conf`. Run the following commands to update the appropriate settings.
51+
52+
A number of tasks relating to provisioning and handling ephemeral disks need to be updated in `/etc/waagent.conf`. Run the following commands to update the appropriate settings.
53+
5054
```bash
5155
sed -i 's/Provisioning.Enabled=y/Provisioning.Enabled=n/g' /etc/waagent.conf
5256
sed -i 's/Provisioning.UseCloudInit=n/Provisioning.UseCloudInit=y/g' /etc/waagent.conf
@@ -67,12 +71,14 @@ If your existing Azure image has a swap file configured and you want to change t
6771
For Red Hat based images - follow the instructions in the following Red Hat document explaining how to [remove the swap file](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/swap-removing-file).
6872

6973
For CentOS images with swapfile enabled, you can run the following command to turn off the swapfile:
74+
7075
```bash
7176
sudo swapoff /mnt/resource/swapfile
7277
```
7378

7479
Ensure the swapfile reference is removed from `/etc/fstab` - it should look something like the following output:
75-
```text
80+
81+
```output
7682
# /etc/fstab
7783
# Accessible filesystems, by reference, are maintained under '/dev/disk'
7884
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
@@ -82,9 +88,11 @@ UUID=7c473048-a4e7-4908-bad3-a9be22e9d37d /boot xfs defaults 0 0
8288
```
8389

8490
To save space and remove the swap file you can run the following command:
91+
8592
```bash
8693
rm /mnt/resource/swapfile
8794
```
95+
8896
## Extra step for cloud-init prepared image
8997
> [!NOTE]
9098
> If your image was previously a **cloud-init** prepared and configured image, you need to do the following steps.
@@ -107,7 +115,7 @@ For more information about the Azure Linux Agent deprovision commands, see the [
107115

108116
Exit the SSH session, then from your bash shell, run the following AzureCLI commands to deallocate, generalize and create a new Azure VM image. Replace `myResourceGroup` and `sourceVmName` with the appropriate information reflecting your sourceVM.
109117

110-
```bash
118+
```azurecli
111119
az vm deallocate --resource-group myResourceGroup --name sourceVmName
112120
az vm generalize --resource-group myResourceGroup --name sourceVmName
113121
az image create --resource-group myResourceGroup --name myCloudInitImage --source sourceVmName

articles/virtual-machines/linux/disks-upload-vhd-to-managed-disk-cli.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Before you can create an empty standard HDD for uploading, you'll need to have t
4141

4242
Create an empty standard HDD for uploading by specifying both the **-–for-upload** parameter and the **--upload-size-bytes** parameter in a [disk create](/cli/azure/disk#az-disk-create) cmdlet:
4343

44-
```bash
44+
```azurecli
4545
az disk create -n mydiskname -g resourcegroupname -l westus2 --for-upload --upload-size-bytes 34359738880 --sku standard_lrs
4646
```
4747

@@ -51,13 +51,13 @@ You have now created an empty managed disk that is configured for the upload pro
5151

5252
To generate a writable SAS of your empty managed disk, use the following command:
5353

54-
```bash
54+
```azurecli
5555
az disk grant-access -n mydiskname -g resourcegroupname --access-level Write --duration-in-seconds 86400
5656
```
5757

5858
Sample returned value:
5959

60-
```
60+
```output
6161
{
6262
"accessSas": "https://md-impexp-t0rdsfgsdfg4.blob.core.windows.net/w2c3mj0ksfgl/abcd?sv=2017-04-17&sr=b&si=600a9281-d39e-4cc3-91d2-923c4a696537&sig=xXaT6mFgf139ycT87CADyFxb%2BnPXBElYirYRlbnJZbs%3D"
6363
}
@@ -77,7 +77,7 @@ AzCopy.exe copy "c:\somewhere\mydisk.vhd" "sas-URI" --blob-type PageBlob
7777

7878
After the upload is complete, and you no longer need to write any more data to the disk, revoke the SAS. Revoking the SAS will change the state of the managed disk and allow you to attach the disk to a VM.
7979

80-
```bash
80+
```azurecli
8181
az disk revoke-access -n mydiskname -g resourcegroupname
8282
```
8383

@@ -92,7 +92,7 @@ The follow script will do this for you, the process is similar to the steps desc
9292
9393
Replace the `<sourceResourceGroupHere>`, `<sourceDiskNameHere>`, `<targetDiskNameHere>`, `<targetResourceGroupHere>`, and `<yourTargetLocationHere>` (an example of a location value would be uswest2) with your values, then run the following script in order to copy a managed disk.
9494

95-
```bash
95+
```azurecli
9696
sourceDiskName = <sourceDiskNameHere>
9797
sourceRG = <sourceResourceGroupHere>
9898
targetDiskName = <targetDiskNameHere>

articles/virtual-machines/linux/migration-classic-resource-manager-plan.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,19 @@ The following were issues discovered in many of the larger migrations. This is n
120120

121121
**Compute** *(Cores, Availability Sets)*
122122

123-
```bash
123+
```azurecli
124124
az vm list-usage -l <azure-region> -o jsonc
125125
```
126126
127127
**Network** *(Virtual Networks, Static Public IPs, Public IPs, Network Security Groups, Network Interfaces, Load Balancers, Route Tables)*
128128
129-
```bash
129+
```azurecli
130130
az network list-usages -l <azure-region> -o jsonc
131131
```
132132
133133
**Storage** *(Storage Account)*
134134
135-
```bash
135+
```azurecli
136136
az storage account show-usage
137137
```
138138

articles/virtual-machines/linux/mount-azure-file-storage-on-linux-using-smb.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ This guide requires that you're running the Azure CLI version 2.0.4 or later. Ru
2424

2525
Create a resource group named *myResourceGroup* in the *East US* location.
2626

27-
```bash
27+
```azurecli
2828
az group create --name myResourceGroup --location eastus
2929
```
3030

3131
## Create a storage account
3232

3333
Create a new storage account, within the resource group that you created, using [az storage account create](/cli/azure/storage/account). This example creates a storage account named *mySTORAGEACCT\<random number>* and puts the name of that storage account in the variable **STORAGEACCT**. Storage account names must be unique, using `$RANDOM` appends a number to the end to make it unique.
3434

35-
```bash
35+
```azurecli
3636
STORAGEACCT=$(az storage account create \
3737
--resource-group "myResourceGroup" \
3838
--name "mystorageacct$RANDOM" \
@@ -47,7 +47,7 @@ When you create a storage account, the account keys are created in pairs so that
4747

4848
View the storage account keys using [az storage account keys list](/cli/azure/storage/account/keys). This example stores the value of key 1 in the **STORAGEKEY** variable.
4949

50-
```bash
50+
```azurecli
5151
STORAGEKEY=$(az storage account keys list \
5252
--resource-group "myResourceGroup" \
5353
--account-name $STORAGEACCT \
@@ -62,7 +62,7 @@ Share names need to be all lower case letters, numbers, and single hyphens but c
6262

6363
This example creates a share named *myshare* with a 10-GiB quota.
6464

65-
```bash
65+
```azurecli
6666
az storage share create --name myshare \
6767
--quota 10 \
6868
--account-name $STORAGEACCT \
@@ -98,6 +98,7 @@ When you reboot the Linux VM, the mounted SMB share is unmounted during shutdown
9898
```bash
9999
//myaccountname.file.core.windows.net/mystorageshare /mnt/mymountpoint cifs vers=3.0,username=mystorageaccount,password=myStorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
100100
```
101+
101102
For increased security in production environments, you should store your credentials outside of fstab.
102103

103104
## Next steps

articles/virtual-machines/linux/openshift-container-platform-3x-prerequisites.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,17 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
5151
## Sign in to Azure
5252
Sign in to your Azure subscription with the [az login](/cli/azure/reference-index) command and follow the on-screen directions, or click **Try it** to use Cloud Shell.
5353

54-
```azurecli
54+
```azurecli
5555
az login
5656
```
57+
5758
## Create a resource group
5859

5960
Create a resource group with the [az group create](/cli/azure/group) command. An Azure resource group is a logical container into which Azure resources are deployed and managed. You should use a dedicated resource group to host the key vault. This group is separate from the resource group into which the OpenShift cluster resources deploy.
6061

6162
The following example creates a resource group named *keyvaultrg* in the *eastus* location:
6263

63-
```azurecli
64+
```azurecli
6465
az group create --name keyvaultrg --location eastus
6566
```
6667

@@ -78,7 +79,7 @@ az keyvault create --resource-group keyvaultrg --name keyvault \
7879
## Create an SSH key
7980
An SSH key is needed to secure access to the OpenShift cluster. Create an SSH key pair by using the `ssh-keygen` command (on Linux or macOS):
8081

81-
```bash
82+
```bash
8283
ssh-keygen -f ~/.ssh/openshift_rsa -t rsa -N ''
8384
```
8485

@@ -112,6 +113,7 @@ Create service principal:
112113
```azurecli
113114
az group show --name openshiftrg --query id
114115
```
116+
115117
Save the output of the command and use in place of $scope in next command
116118

117119
```azurecli
@@ -120,6 +122,7 @@ az ad sp create-for-rbac --name openshiftsp \
120122
```
121123

122124
Take note of the appId property and password returned from the command:
125+
123126
```json
124127
{
125128
"appId": "11111111-abcd-1234-efgh-111111111111",
@@ -129,6 +132,7 @@ Take note of the appId property and password returned from the command:
129132
"tenant": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
130133
}
131134
```
135+
132136
> [!WARNING]
133137
> Be sure to write down the secure password as it will not be possible to retrieve this password again.
134138
@@ -157,7 +161,7 @@ You'll need to store these files in Key Vault secrets. Use the same Key Vault a
157161

158162
Create the secrets using the Azure CLI. Below is an example.
159163

160-
```bash
164+
```azurecli
161165
az keyvault secret set --vault-name KeyVaultName -n mastercafile --file ~/certificates/masterca.pem
162166
```
163167

articles/virtual-machines/linux/openshift-container-platform-3x-troubleshooting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ The private key is copied into the ansible playbook host - ~/.ssh/id_rsa. Confir
9999

100100
When providing the input to the template or Marketplace offer, the incorrect information was provided. Make sure you use the correct appId (clientId) and password (clientSecret) for the service principal. Verify by issuing the following azure cli command.
101101

102-
```bash
102+
```azurecli
103103
az login --service-principal -u <client id> -p <client secret> -t <tenant id>
104104
```
105105

106106
### Service principal doesn't have contributor access to the resource group
107107

108108
If the Azure cloud provider is enabled, then the service principal used must have contributor access to the resource group. Verify by issuing the following azure cli command.
109109

110-
```bash
110+
```azurecli
111111
az group update -g <openshift resource group> --set tags.sptest=test
112112
```
113113

articles/virtual-machines/linux/tutorial-backup-vms.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you accidentally delete or make changes to a file, you can use File Recovery
6262

6363
In this example, we show how to recover the default nginx web page /var/www/html/index.nginx-debian.html. The public IP address of our VM in this example is *13.69.75.209*. You can find the IP address of your vm using:
6464

65-
```bash
65+
```azurecli
6666
az vm show --resource-group myResourceGroup --name myVM -d --query [publicIps] --o tsv
6767
```
6868

@@ -76,6 +76,7 @@ In this example, we show how to recover the default nginx web page /var/www/html
7676
```bash
7777
ssh 13.69.75.209
7878
```
79+
7980
2. Delete /var/www/html/index.nginx-debian.html.
8081

8182
```bash
@@ -120,7 +121,7 @@ In this example, we show how to recover the default nginx web page /var/www/html
120121

121122
12. The output from the script gives you the path for the mount point. The output looks similar to this:
122123

123-
```bash
124+
```output
124125
Microsoft Azure VM Backup - File Recovery
125126
______________________________________________
126127

0 commit comments

Comments
 (0)