Resources
| where type =~ 'microsoft.network/virtualnetworks'
| mv-expand subnet = properties.subnets
| extend subnetName = tostring(subnet.name)
| where subnetName == 'AzureBastionSubnet'
| extend addressPrefix = tostring(coalesce(subnet.properties.addressPrefix,
subnet.properties.addressPrefixes[0]))
| where name in~ (
'vnet1',
'vnet2',
'vnet3',
'vnet4'
)
| project subscriptionId,
resourceGroup,
vnetName = name,
subnetName,
addressPrefix,
location
| order by subscriptionId, resourceGroup
—- ~~SUMMARY~~ This page captures every turn of our ChatGPT session covering Azure Bastion subnet exports with both Azure CLI and Azure Resource Graph methods, plus formatting guidance.
bastion subnet export
Do you mean you’d like to export the configuration of a Bastion subnet (for example in Azure or AWS) into something like Terraform / Bicep / CloudFormation, or are you trying to pull the current subnet’s address range, route table, etc., into a file? Let me know which cloud or tooling you’re using and what exactly you want to export so I can give you the right steps.
i want an export of all my bastion subnet in azure using az cli
Below is a ready‑to‑run Bash script that will enumerate every Azure Bastion subnet (`AzureBastionSubnet`) in all the subscriptions your account can access and export the results to both JSON and CSV.
#!/usr/bin/env bash # export_bastion_subnets.sh set -euo pipefail echo "Collecting Azure Bastion subnets from all subscriptions…" tmp_json="$(mktemp)" while IFS=$'\t' read -r subName subId; do echo "→ Subscription: $subName ($subId)" az account set --subscription "$subId" az network vnet list --query \ "[].{resourceGroup:resourceGroup, vnetName:name, location:location, subnets:subnets[?name=='AzureBastionSubnet']}" \ -o json | jq -c '.[] | select(.subnets != null and .subnets | length > 0) | {subscriptionId:"'"$subId"'", resourceGroup, vnetName, location, addressPrefix:(.subnets[0].addressPrefix)}' >> "$tmp_json" done < <(az account list --query "[].{name:name,id:id}" -o tsv) jq -s '.' "$tmp_json" > bastion_subnets.json rm "$tmp_json" jq -r ' ["subscriptionId","resourceGroup","vnetName","addressPrefix","location"], (.[] | [.subscriptionId, .resourceGroup, .vnetName, .addressPrefix, .location]) ' bastion_subnets.json > bastion_subnets.csv echo "✔ Done!" echo " • bastion_subnets.json – full‑fidelity export" echo " • bastion_subnets.csv – tabular view for spreadsheets"
chmod +x export_bastion_subnets.sh az login sudo apt-get install jq # or your package manager ./export_bastion_subnets.sh
az network vnet list \ --query "[].subnets[?name=='AzureBastionSubnet'].[id,addressPrefix]" \ -o table
does it work with graph explorer
Short answer – Yes, with Azure Resource Graph Explorer (ARG Explorer). If you meant Microsoft Graph Explorer: it doesn’t expose Azure networking resources.
Resources
| where type =~ 'microsoft.network/virtualnetworks'
| mv-expand subnet = properties.subnets
| extend subnetName = tostring(subnet.name)
| where subnetName == 'AzureBastionSubnet'
| extend addressPrefix = tostring(coalesce(subnet.properties.addressPrefix,
subnet.properties.addressPrefixes[0]))
| project subscriptionId,
resourceGroup,
vnetName = name,
subnetName,
addressPrefix,
location
| order by subscriptionId, resourceGroup
giv me me more details using resource graph explorer to export all azurebastion subnets
Azure Resource Graph (ARG) keeps a continuously‑indexed, read‑only copy of every resource you can access. With a single KQL query you can list every `AzureBastionSubnet`, then export from the portal or automate with the CLI.
az extension add --name resource-graph # once az graph query -q "$(cat bastion.kql)" --first 5000 \ -o json > bastion_subnets.json
Install-Module Az.ResourceGraph -Scope CurrentUser # once $kql = Get-Content .\bastion.kql -Raw Search-AzGraph -Query $kql -First 5000 | Export-Csv .\bastion_subnets.csv -NoTypeInformation
give me this whole comunication in dokuwiki format
*You’re reading it!* Copy everything in this grey box into any DokuWiki page and it will render with proper headings, code highlighting and horizontal rules.