Skip to content

Commit bb06370

Browse files
Syntax blocks azurecli.
1 parent e4c4258 commit bb06370

14 files changed

+93
-77
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/image-builder-user-assigned-identity.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ az provider register -n Microsoft.Storage
5959
We will be using some pieces of information repeatedly, so we will create some variables to store that information.
6060

6161

62-
```azurecli-interactive
62+
```console
6363
# Image resource group name
6464
imageResourceGroup=aibmdimsi
6565
# storage resource group
@@ -74,7 +74,7 @@ runOutputName=u1804ManImgMsiro
7474

7575
Create a variable for your subscription ID. You can get this using `az account show | grep id`.
7676

77-
```azurecli-interactive
77+
```console
7878
subscriptionID=<Your subscription ID>
7979
```
8080

@@ -148,7 +148,7 @@ imgBuilderId=/subscriptions/$subscriptionID/resourcegroups/$imageResourceGroup/p
148148

149149
Download the example .json file and configure it with the variables you created.
150150

151-
```azurecli-interactive
151+
```console
152152
curl https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/7_Creating_Custom_Image_using_MSI_to_Access_Storage/helloImageTemplateMsi.json -o helloImageTemplateMsi.json
153153
sed -i -e "s/<subscriptionID>/$subscriptionID/g" helloImageTemplateMsi.json
154154
sed -i -e "s/<rgName>/$imageResourceGroup/g" helloImageTemplateMsi.json
@@ -188,7 +188,7 @@ Wait for the build to complete. This can take about 15 minutes.
188188

189189
Create a VM from the image.
190190

191-
```bash
191+
```azurecli
192192
az vm create \
193193
--resource-group $imageResourceGroup \
194194
--name aibImgVm00 \
@@ -200,13 +200,13 @@ az vm create \
200200

201201
After the VM has been created, start an SSH session with the VM.
202202

203-
```azurecli-interactive
203+
```console
204204
ssh aibuser@<publicIp>
205205
```
206206

207207
You should see the image was customized with a Message of the Day as soon as your SSH connection is established!
208208

209-
```console
209+
```output
210210
211211
*******************************************************
212212
** This VM was built from the: **

articles/virtual-machines/linux/image-builder.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ az provider register -n Microsoft.Storage
6060
We will be using some pieces of information repeatedly, so we will create some variables to store that information.
6161

6262

63-
```azurecli-interactive
63+
```console
6464
# Resource group name - we are using myImageBuilderRG in this example
6565
imageResourceGroup=myImageBuilerRGLinux
6666
# Datacenter location - we are using West US 2 in this example
@@ -73,7 +73,7 @@ runOutputName=aibLinux
7373

7474
Create a variable for your subscription ID. You can get this using `az account show | grep id`.
7575

76-
```azurecli-interactive
76+
```console
7777
subscriptionID=<Your subscription ID>
7878
```
7979

@@ -100,7 +100,7 @@ az role assignment create \
100100

101101
A parameterized sample image configuration template has been created for you to use. Download the sample .json file and configure it with the variables you set earlier.
102102

103-
```azurecli-interactive
103+
```console
104104
curl https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/0_Creating_a_Custom_Linux_Managed_Image/helloImageTemplateLinux.json -o helloImageTemplateLinux.json
105105

106106
sed -i -e "s/<subscriptionID>/$subscriptionID/g" helloImageTemplateLinux.json
@@ -112,7 +112,7 @@ sed -i -e "s/<runOutputName>/$runOutputName/g" helloImageTemplateLinux.json
112112

113113
You can modify this example .json as needed. For example, you can increase the value of `buildTimeoutInMinutes` to allow for longer running builds. You can edit the file in Cloud Shell using a text editor like `vi`.
114114

115-
```azurecli-interactive
115+
```console
116116
vi helloImageTemplateLinux.json
117117
```
118118

@@ -184,13 +184,13 @@ az vm create \
184184

185185
Get the IP address from the output of creating the VM and use it to SSH to the VM.
186186

187-
```azurecli-interactive
187+
```console
188188
ssh azureuser@<pubIp>
189189
```
190190

191191
You should see the image was customized with a Message of the Day as soon as your SSH connection is established!
192192

193-
```console
193+
```output
194194
195195
*******************************************************
196196
** This VM was built from the: **
@@ -205,7 +205,7 @@ Type `exit` when you are done to close the SSH connection.
205205

206206
In the Image Builder Template, in the 'Properties', you will see the source image, customization script it runs, and where it is distributed.
207207

208-
```azurecli-interactive
208+
```console
209209
cat helloImageTemplateLinux.json
210210
```
211211

@@ -226,7 +226,7 @@ az resource delete \
226226

227227
Delete the image resource group.
228228

229-
```bash
229+
```azurecli
230230
az group delete -n $imageResourceGroup
231231
```
232232

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

0 commit comments

Comments
 (0)