website logo
HomeGithubSlack
⌘K
Overview
Quick Start
Supported Services
Running CloudGraph in EKS
Compliance
Rules Engine
AWS
Querying AWS Data
AWS Policy Packs
Billing Data
Services
Azure
Querying Azure Data
Azure Policy Packs
Services
GCP
Querying GCP Data
GCP Policy Packs
Services
K8s
Querying Kubernetes Data
Services
Docs powered by
Archbee
Azure
Services

Event Hub

15min

Note: 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.

Overview

You can currently query the following attributes and connections on an Azure Event Hub

GraphQL
|
query {
  queryazureEventHub{
    id
    name
    type
    subscriptionId
    region
    resourceGroupId
    createdBy
    createdByType
    createdAt
    lastModifiedBy
    lastModifiedByType
    lastModifiedAt
    partitionIds
    updatedAt
    messageRetentionInDays
    partitionCount
    status
    captureDescription{
      enabled
      encoding
      intervalInSeconds
      sizeLimitInBytes
      destination{
        name
        storageAccountResourceId
        blobContainer
        archiveNameFormat
        dataLakeSubscriptionId
        dataLakeAccountName
        dataLakeFolderPath
      }
      skipEmptyArchives
    }
    resourceGroup{
        id
        # Other fields and connections here...
      }
    storageAccount {
        id
        # Other fields and connections here...
      }
  }
}


Filtering

Get data for a single Azure Event Hub key that you know the ID for:

GraphQL
|
query {
  getazureEventHub(id: "12345") {
    id
    # Other fields and connections here...
  }
}


Get data for all of the Event Hubs in a certain Azure subscription:

GraphQL
|
query {
  queryazureEventHub(filter: { subscriptionId: { eq: "12345" } }) {
    id
    # Other fields and connections here...
  }
}

# Note that in addition to "subscriptionId" you can
# Filter based on any of the following attributes:

# id
# name
# type
# region
# resourceGroupId
# createdBy
# createdByType
# createdAt
# lastModifiedBy
# lastModifiedByType
# lastModifiedAt
# partitionIds
# updatedAt
# messageRetentionInDays
# partitionCount
# status

# And the following Dgraph filters can also be applied:

# has
# and
# or
# not
# regexp (regular expressions)

# fulltext filters

# alloftext
# anyoftext


Get data for all of the Event Hubs that are NOT in a certain Azure subscription:

GraphQL
|
query {
  queryazureEventHub(filter: { not: { subscriptionId: { eq: "12345" } } }) {
    id
    # Other fields and connections here...
  }
}


Advanced Filtering

Get data for all of the Event Hubs that are connected to a storageAccount:

GraphQL
|
query {
  queryazureEventHub(filter: { has: storageAccounts }) {
    id
    # Other fields and connections here...
  }
}


Ordering

You can order the results you get back either asc or desc depending on your preference:

GraphQL
|
query {
  queryazureEventHub(order: { desc: name }) {
    id
    # Other fields and connections here...
  }
}

# Note that in addition to "name" you can filter
# Using "asc" or "desc" based on any of the following attributes:

# id
# subscriptionId
# type
# region
# resourceGroupId
# createdBy
# createdByType
# createdAt
# lastModifiedBy
# lastModifiedByType
# lastModifiedAt
# partitionIds
# updatedAt
# messageRetentionInDays
# partitionCount
# status


Only select and return the first two Event Hubs that are found:

GraphQL
|
query {
  queryazureEventHub(first: 2, order: { desc: name }) {
    id
    # Other fields and connections here...
  }
}


Only select and return the first two Event Hubs that are found, but offset by one so keys two & three are returned:

GraphQL
|
query {
  queryazureEventHub(first: 2, order: { desc: name }, offset: 1) {
    id
    # Other fields and connections here...
  }
}


Aggregation

Count the number of Event Hubs across all scanned Azure subscriptions:

GraphQL
|
query {
  aggregateazureEventHub {
    count
    # Other fields and connections here...
  }
}

# Note that in addition to "count" you can request the
# Following min and max values based on attributes of your Virtual Machines:

# idMin
# idMax
# nameMin
# nameMax
# typeMin
# typeMax
# subscriptionIdMin
# subscriptionIdMax
# regionMin
# regionMax
# resourceGroupIdMin
# resourceGroupIdMax
# createdByMin
# createdByMax
# createdByTypeMin
# createdByTypeMax
# createdAtMin
# createdAtMax
# lastModifiedByMin
# lastModifiedByMax
# lastModifiedByTypeMin
# lastModifiedByTypeMax
# lastModifiedAtMin
# lastModifiedAtMax
# updatedAtMin
# updatedAtMax
# messageRetentionInDaysMin
# messageRetentionInDaysMax
# messageRetentionInDaysSum
# messageRetentionInDaysAvg
# partitionCountMin
# partitionCountMax
# partitionCountSum
# partitionCountAvg
# statusMin
# statusMax


Count the number of Event Hubs in a single account. Note that you can apply all of the same filters that are listed above to aggregate queries:

GraphQL
|
query {
  aggregateazureEventHub(filter: { subscriptionId: { eq: "12345" } }) {
    count
    # Other fields and connections here...
  }
}


Examples

Find all of the Event Hubs that are in the eastus region across all your accounts:

GraphQL
|
query {
  queryazureEventHub(filter: { region: { eq: "eastus" } }) {
    id
    # Other fields and connections here...
  }
}


Kitchen Sink

Putting it all together; get all data for all Event Hubs 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, disk -> virtualMachine -> networkInterface ...etc:

GraphQL
|
query {
  queryazureEventHub {
    id
    name
    type
    subscriptionId
    region
    resourceGroupId
    createdBy
    createdByType
    createdAt
    lastModifiedBy
    lastModifiedByType
    lastModifiedAt
    partitionIds
    updatedAt
    messageRetentionInDays
    partitionCount
    status
    captureDescription{
      enabled
      encoding
      intervalInSeconds
      sizeLimitInBytes
      destination{
        name
        storageAccountResourceId
        blobContainer
        archiveNameFormat
        dataLakeSubscriptionId
        dataLakeAccountName
        dataLakeFolderPath
      }
      skipEmptyArchives
    }
    resourceGroup{
      id
      name
      type
      kind
      subscriptionId
      region
      managedBy
      disks {
        id
        # Other fields and connections here...
      }
      appServicePlans{
        id
        # Other fields and connections here...
      }
      appServiceWebApps{
        id
        # Other fields and connections here...
      }
      disks{
        id
        # Other fields and connections here...
      }
      dns{
        id
        # Other fields and connections here...
      }
      eventGrids{
        id
        # Other fields and connections here...
      }
      eventHubs{
        id
        # Other fields and connections here...
      }
      firewalls{
        id
        # Other fields and connections here...
      }
      functionApps{
        id
        # Other fields and connections here...
      }
      keyVaults{
        id
        # Other fields and connections here...
      }
      networkInterfaces{
        id
        # Other fields and connections here...
      }
      publicIps{
        id
        # Other fields and connections here...
      }
      securityGroups{
        id
        # Other fields and connections here...
      }
      storageAccounts{
        id
        # Other fields and connections here...
      }
      storageBlobs{
        id
        # Other fields and connections here...
      }
      storageContainers{
        id
        # Other fields and connections here...
      }
      virtualMachines{
        id
        # Other fields and connections here...
      }
      virtualMachineScaleSets{
        id
        # Other fields and connections here...
      }
      virtualNetworks{
        id
        # Other fields and connections here...
      }
      privateDns{
        id
        # Other fields and connections here...
      }
      tags{
        id
        key
        value
      }
    }
    storageAccount {
      id
      name
      type
      kind
      subscriptionId
      region
      resourceGroupId
      extendedLocationName
      extendedLocationType
      provisioningState
      primaryEndpoints{
        blob
        queue
        table
        file
        web
        dfs
      }
      primaryMicrosoftEndpoints {
        blob
        queue
        table
        file
        web
        dfs
      }
      primaryInternetEndpoints{
        blob
        file
        web
        dfs
      }
      primaryLocation
      statusOfPrimary
      lastGeoFailoverTime
      secondaryLocation
      statusOfSecondary
      customDomainName
      customDomainUseSubDomainName
      sasPolicyExpirationPeriod
      keyPolicyExpirationPeriodInDays
      keyCreationTimeKey1
      keyCreationTimeKey2
      encryptionServiceBlob{
        enabled
        lastEnabledTime
        keyType
      }
      encryptionServiceFile{
        enabled
        lastEnabledTime
        keyType
      }
      encryptionServiceTable{
        enabled
        lastEnabledTime
        keyType
      }
      encryptionServiceQueue{
        enabled
        lastEnabledTime
        keyType
      }
      encryptionKeySource
      encryptionRequireInfrastructureEncryption
      encryptionKeyVaultPropertyKeyName
      encryptionKeyVaultPropertyKeyVersion
      encryptionKeyVaultPropertyKeyVaultUri
      encryptionKeyVaultPropertyCurrentVersionedKeyIdentifier
      encryptionKeyVaultPropertyLastKeyRotationTimestamp
      encryptionUserAssignedIdentity
      accessTier
      azureFilesIdentityBasedAuthenticationDirectoryServiceOptions
      azureFilesIdentityBasedAuthenticationADProperties{
        domainName
        netBiosDomainName
        forestName
        domainGuid
        domainSid
        azureStorageSid
      }
      enableHttpsTrafficOnly
      networkRuleSetByPass
      networkRuleResourceAccessRules {
        id
        tenantId
        resourceId
      }
      networkRuleVirtualNetworkRules {
        id
        virtualNetworkResourceId
        action
        state
      }
      networkRuleIpRules{
        id
        iPAddressOrRange
        action
      }
      networkRuleSetDefaultAction
      isHnsEnabled
      geoReplicationStatsStatus
      geoReplicationStatsLastSyncTime
      geoReplicationStatsCanFailover
      failoverInProgress
      largeFileSharesState
      privateEndpointConnections{
        id
        privateEndpointId
        privateLinkServiceConnectionStateStatus
        privateLinkServiceConnectionStateDescription
        privateLinkServiceConnectionStateActionRequired
        provisioningState
      }
      routingPreferenceChoice
      routingPreferencePublishMicrosoftEndpoints
      routingPreferencePublishInternetEndpoints
      allowBlobPublicAccess
      minimumTlsVersion
      allowSharedKeyAccess
      enableNfsV3
      resourceGroup {
        id
        # Other fields and connections here...
      }
      storageContainers {
        id
        # Other fields and connections here...
      }
      tags{
        id
        key
        value
      }
    }
  }
}


References

Dgraph documentation on querying

Azure Event Hub Documentation

Updated 03 Mar 2023
Did this page help you?
PREVIOUS
Event Grid
NEXT
Key Vault
Docs powered by
Archbee
TABLE OF CONTENTS
Overview
Filtering
Advanced Filtering
Ordering
Aggregation
Examples
Kitchen Sink
References
Docs powered by
Archbee