Skip to content

Commit 536dd0d

Browse files
Merge pull request #279540 from davidsmatlak/ds-edit-arg-cli-20240627
Edits ARG quickstarts
2 parents 4aeb3ea + b97aa97 commit 536dd0d

File tree

4 files changed

+52
-50
lines changed

4 files changed

+52
-50
lines changed

articles/governance/resource-graph/first-query-azurecli.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Quickstart: Run Resource Graph query using Azure CLI"
33
description: In this quickstart, you run a Resource Graph query using Azure CLI and the resource-graph extension.
4-
ms.date: 06/26/2024
4+
ms.date: 06/27/2024
55
ms.topic: quickstart
66
ms.custom: devx-track-azurecli
77
---
@@ -16,18 +16,6 @@ This quickstart describes how to run an Azure Resource Graph query using the Azu
1616
- [Azure CLI](/cli/azure/install-azure-cli) must be version 2.22.0 or higher for the Resource Graph extension.
1717
- A Bash shell environment where you can run Azure CLI commands. For example, Git Bash in a [Visual Studio Code](https://code.visualstudio.com/) terminal session.
1818

19-
## Connect to Azure
20-
21-
From a Visual Studio Code terminal session, connect to Azure. If you have more than one subscription, run the commands to set context to your subscription. Replace `<subscriptionID>` with your Azure subscription ID.
22-
23-
```azurecli
24-
az login
25-
26-
# Run these commands if you have multiple subscriptions
27-
az account list --output table
28-
az account set --subscription <subscriptionID>
29-
```
30-
3119
## Install the extension
3220

3321
To enable Azure CLI to query resources using Azure Resource Graph, the Resource Graph extension must be installed. The first time you run a query with `az graph` a prompt is displayed to install the extension. Otherwise, use the following steps to do a manual installation.
@@ -58,6 +46,18 @@ To enable Azure CLI to query resources using Azure Resource Graph, the Resource
5846

5947
For more information about Azure CLI extensions, go to [Use and manage extensions with the Azure CLI](/cli/azure/azure-cli-extensions-overview).
6048

49+
## Connect to Azure
50+
51+
From a Visual Studio Code terminal session, connect to Azure. If you have more than one subscription, run the commands to set context to your subscription. Replace `<subscriptionID>` with your Azure subscription ID.
52+
53+
```azurecli
54+
az login
55+
56+
# Run these commands if you have multiple subscriptions
57+
az account list --output table
58+
az account set --subscription <subscriptionID>
59+
```
60+
6161
## Run a query
6262

6363
After the Azure CLI extension is added to your environment, you can run a tenant-based query. The query in this example returns five Azure resources with the `name` and `type` of each resource. To query by [management group](../management-groups/overview.md) or subscription, use the `--management-groups` or `--subscriptions` arguments.
@@ -102,7 +102,7 @@ az logout
102102

103103
## Next steps
104104

105-
In this quickstart, you ran Azure Resource Graph queries using the extension for Azure CLI. To learn more, go to the query language details article.
105+
In this quickstart, you ran Azure Resource Graph queries using the extension for Azure CLI. To learn more about the Resource Graph language, continue to the query language details page.
106106

107107
> [!div class="nextstepaction"]
108108
> [Understanding the Azure Resource Graph query language](./concepts/query-language.md)

articles/governance/resource-graph/shared-query-azure-cli.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Quickstart: Create Resource Graph shared query using Azure CLI"
33
description: In this quickstart, you create an Azure Resource Graph shared query using Azure CLI and the resource-graph extension.
4-
ms.date: 06/26/2024
4+
ms.date: 06/27/2024
55
ms.topic: quickstart
66
ms.custom: devx-track-azurecli
77
---
@@ -18,18 +18,6 @@ A shared query can be run from Azure CLI with the _experimental_ feature's comma
1818
- [Azure CLI](/cli/azure/install-azure-cli) must be version 2.22.0 or higher for the Resource Graph extension.
1919
- A Bash shell environment where you can run Azure CLI commands. For example, Git Bash in a [Visual Studio Code](https://code.visualstudio.com/) terminal session.
2020

21-
## Connect to Azure
22-
23-
From a Visual Studio Code terminal session, connect to Azure. If you have more than one subscription, run the commands to set context to your subscription. Replace `<subscriptionID>` with your Azure subscription ID.
24-
25-
```azurecli
26-
az login
27-
28-
# Run these commands if you have multiple subscriptions
29-
az account list --output table
30-
az account set --subscription <subscriptionID>
31-
```
32-
3321
## Install the extension
3422

3523
To enable Azure CLI to query resources using Azure Resource Graph, the Resource Graph extension must be installed. The first time you run a query with `az graph` a prompt is displayed to install the extension. Otherwise, use the following steps to do a manual installation.
@@ -60,6 +48,18 @@ To enable Azure CLI to query resources using Azure Resource Graph, the Resource
6048

6149
For more information about Azure CLI extensions, go to [Use and manage extensions with the Azure CLI](/cli/azure/azure-cli-extensions-overview).
6250

51+
## Connect to Azure
52+
53+
From a Visual Studio Code terminal session, connect to Azure. If you have more than one subscription, run the commands to set context to your subscription. Replace `<subscriptionID>` with your Azure subscription ID.
54+
55+
```azurecli
56+
az login
57+
58+
# Run these commands if you have multiple subscriptions
59+
az account list --output table
60+
az account set --subscription <subscriptionID>
61+
```
62+
6363
## Create a shared query
6464

6565
Create a resource group and a shared that summarizes the count of all resources grouped by location.
@@ -126,16 +126,24 @@ You can verify the shared query works using Azure Resource Graph Explorer. To ch
126126
1. Change **Type** to _Shared queries_.
127127
1. Select the query _Count VMs by OS_.
128128
1. Select **Run query** and the view output in the **Results** tab.
129+
1. Select **Charts** and then select **Map** to view the location map.
129130

130131
You can also run the query from your resource group.
131132

132133
1. In Azure, go to the resource group, _demoSharedQuery_.
133134
1. From the **Overview** tab, select the query _Count VMs by OS_.
134135
1. Select the **Results** tab.
136+
1. Select **Charts** and then select **Map** to view the location map.
135137

136138
## Clean up resources
137139

138-
To remove the resource group and shared query:
140+
To remove the shared query:
141+
142+
```azurecli
143+
az graph shared-query delete --name "Summarize resources by location" --resource-group demoSharedQuery
144+
```
145+
146+
When a resource group is deleted, the resource group and all its resources are deleted. To remove the resource group:
139147

140148
```azurecli
141149
az group delete --name demoSharedQuery
@@ -155,9 +163,7 @@ az logout
155163

156164
## Next steps
157165

158-
In this quickstart, you added the Resource Graph extension to your Azure CLI environment and
159-
created a shared query. To learn more about the Resource Graph language, continue to the query
160-
language details page.
166+
In this quickstart, you added the Resource Graph extension to your Azure CLI environment and created a shared query. To learn more about the Resource Graph language, continue to the query language details page.
161167

162168
> [!div class="nextstepaction"]
163169
> [Understanding the Azure Resource Graph query language](./concepts/query-language.md)

articles/governance/resource-graph/shared-query-bicep.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ Create a resource group and deploy the Bicep file with Azure CLI or Azure PowerS
6767
# [Azure CLI](#tab/azure-cli)
6868

6969
```azurecli
70-
az group create --name exampleRG --location eastus
71-
az deployment group create --resource-group exampleRG --template-file main.bicep
70+
az group create --name demoSharedQuery --location eastus
71+
az deployment group create --resource-group demoSharedQuery --template-file main.bicep
7272
```
7373

7474
# [Azure PowerShell](#tab/azure-powershell)
7575

7676
```azurepowershell
77-
New-AzResourceGroup -Name exampleRG -Location eastus
78-
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile main.bicep
77+
New-AzResourceGroup -Name demoSharedQuery -Location eastus
78+
New-AzResourceGroupDeployment -ResourceGroupName demoSharedQuery -TemplateFile main.bicep
7979
```
8080

8181
---
@@ -89,13 +89,13 @@ Use Azure CLI or Azure PowerShell to list the deployed resources in the resource
8989
# [Azure CLI](#tab/azure-cli)
9090

9191
```azurecli
92-
az resource list --resource-group exampleRG
92+
az resource list --resource-group demoSharedQuery
9393
```
9494

9595
# [Azure PowerShell](#tab/azure-powershell)
9696

9797
```azurepowershell
98-
Get-AzResource -ResourceGroupName exampleRG
98+
Get-AzResource -ResourceGroupName demoSharedQuery
9999
```
100100

101101
---
@@ -116,18 +116,18 @@ You can verify the shared query works using Azure Resource Graph Explorer. To ch
116116

117117
You can also run the query from your resource group.
118118

119-
1. In Azure, go to the resource group, _exampleRG_.
119+
1. In Azure, go to the resource group, _demoSharedQuery_.
120120
1. From the **Overview** tab, select the query _Count VMs by OS_.
121121
1. Select the **Results** tab.
122122

123123
## Clean up resources
124124

125-
When you no longer need the resource that you created, delete the resource group using Azure CLI or Azure PowerShell. And if you signed into Azure portal to run the query, be sure to sign out.
125+
When you no longer need the resource that you created, delete the resource group using Azure CLI or Azure PowerShell. When a resource group is deleted, the resource group and all its resources are deleted. And if you signed into Azure portal to run the query, be sure to sign out.
126126

127127
# [Azure CLI](#tab/azure-cli)
128128

129129
```azurecli
130-
az group delete --name exampleRG
130+
az group delete --name demoSharedQuery
131131
```
132132

133133
To sign out of your Azure CLI session:
@@ -139,7 +139,7 @@ az logout
139139
# [Azure PowerShell](#tab/azure-powershell)
140140

141141
```azurepowershell
142-
Remove-AzResourceGroup -Name exampleRG
142+
Remove-AzResourceGroup -Name demoSharedQuery
143143
```
144144

145145
To sign out of your Azure PowerShell session:
@@ -152,9 +152,7 @@ Disconnect-AzAccount
152152

153153
## Next steps
154154

155-
In this quickstart, you created a Resource Graph shared query using Bicep.
156-
157-
To learn more about shared queries, continue to the tutorial for:
155+
In this quickstart, you created a Resource Graph shared query using Bicep. To learn more about the Resource Graph language, continue to the query language details page.
158156

159157
> [!div class="nextstepaction"]
160-
> [Tutorial: Create and share an Azure Resource Graph query in the Azure portal](./tutorials/create-share-query.md)
158+
> [Understanding the Azure Resource Graph query language](./concepts/query-language.md)

articles/governance/resource-graph/shared-query-template.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Quickstart: Create Resource Graph shared query using ARM template'
2+
title: "Quickstart: Create Resource Graph shared query using ARM template"
33
description: In this quickstart, you use an Azure Resource Manager template (ARM template) to create a Resource Graph shared query that counts virtual machines by OS.
44
ms.date: 06/26/2024
55
ms.topic: quickstart
@@ -91,9 +91,7 @@ To remove the shared query created, follow these steps:
9191

9292
## Next steps
9393

94-
In this quickstart, you created a Resource Graph shared query.
95-
96-
To learn more about shared queries, continue to the tutorial for:
94+
In this quickstart, you created a Resource Graph shared query. To learn more about the Resource Graph language, continue to the query language details page.
9795

9896
> [!div class="nextstepaction"]
99-
> [Manage queries in Azure portal](./tutorials/create-share-query.md)
97+
> [Understanding the Azure Resource Graph query language](./concepts/query-language.md)

0 commit comments

Comments
 (0)