dNote: if you are running CloudGraph locally you can view the interactive, automatically generated documentation in either GraphQL Playground or Altair by clicking the docs button on the right-hand side of the screen. After reading the below information we highly suggest you use one of these tools to test your queries as they will autocomplete fields for you and let you know if your queries are valid before you even submit them.
You can currently query the following attributes and connections on an Azure DNS Zones
query {
queryazureDnsZone{
id
name
type
kind
subscriptionId
region
resourceGroupId
maxNumberOfRecordSets
numberOfRecordSets
nameServers
zoneType
recordSets{
tTL
fqdn
provisioningState
targetResourceId
aRecords
aaaaRecords
mxRecords{
id
exchange
preference
}
nsRecords
ptrRecords
srvRecords{
id
priority
weight
port
target
}
txtRecords{
id
value
}
cnameRecord
soaRecord{
host
email
serialNumber
refreshTime
retryTime
expireTime
minimumTtl
}
caaRecords{
id
flags
tag
value
}
resourceGroupId
}
tags{
id
key
value
}
resourceGroup{
id
}
}
}
Get data for a single Azure DNS Zone key that you know the ID for:
query {
getazureDnsZone(id: "12345") {
id
}
}
Get data for all of the DNS Zones in a certain Azure subscription:
query {
queryazureDnsZone(filter: { subscriptionId: { eq: "12345" } }) {
id
}
}
Get data for all of the DNS Zones that are NOT in a certain Azure subscription:
query {
queryazureDnsZone(filter: { not: { subscriptionId: { eq: "12345" } } }) {
id
}
}
Get data for all of the DNS Zones that are connected to an resourceGroup:
query {
queryazureDnsZone(filter: { has: { resourceGroup } }) {
id
}
}
You can order the results you get back either asc or desc depending on your preference:
query {
queryazureDnsZone(order: { desc: name }) {
id
}
}
Only select and return the first two DNS Zones that are found:
query {
queryazureDnsZone(first: 2, order: { desc: name }) {
id
}
}
Only select and return the first two DNS Zones that are found, but offset by one so keys two & three are returned:
query {
queryazureDnsZone(first: 2, order: { desc: name }, offset: 1) {
id
}
}
Count the number of DNS Zones across all scanned Azure subscriptions:
query {
aggregateazureDnsZone {
count
}
}
Count the number of DNS Zones in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:
query {
aggregateazureDnsZone(filter: { subscriptionId: { eq: "12345" } }) {
count
}
}
Find all of the DNS Zones that are in the eastus region across all your accounts:
query {
queryazureDnsZone(filter: { region: { eq: "eastus" } }) {
id
}
}
Find all of the DNS Zones that have a tag of Environment:Production for a single Azure Subscription:
query {
queryazureTag(
filter: { key: { eq: "Environment" }, value: { eq: "Production" } }
) {
dns(filter: { subscriptionId: { eq: "12345" } }) {
id
}
}
}
With CloudGraph you can run multiple queries at the same time so you can combine the above two queries if you like:
query {
queryazureDnsZone(filter: { region: { eq: "eastus" } }) {
id
}
queryazureTag(
filter: { key: { eq: "Environment" }, value: { eq: "Production" } }
) {
dns(filter: { subscriptionId: { eq: "12345" } }) {
id
}
}
}
Putting it all together; get all data for all DNS Zones across all regions for all scanned Azure subscriptions in a single query. For the purposes of this example, we will only get direct children of the keys but if you want to it's easy to go from say, dnsZone -> virtualMachine -> networkInterface ...etc:
query {
queryazureDnsZone{
id
name
type
kind
subscriptionId
region
resourceGroupId
maxNumberOfRecordSets
numberOfRecordSets
nameServers
zoneType
recordSets{
tTL
fqdn
provisioningState
targetResourceId
aRecords
aaaaRecords
mxRecords{
id
exchange
preference
}
nsRecords
ptrRecords
srvRecords{
id
priority
weight
port
target
}
txtRecords{
id
value
}
cnameRecord
soaRecord{
host
email
serialNumber
refreshTime
retryTime
expireTime
minimumTtl
}
caaRecords{
id
flags
tag
value
}
resourceGroupId
}
tags{
id
key
value
}
resourceGroup{
id
name
type
kind
subscriptionId
region
managedBy
}
}
}