Skip to content

⭐ Expand Azure resources + scan additional Azure resources as their own platforms#6630

Merged
syrull merged 2 commits intomainfrom
tas50/new_azure_platforms
Feb 25, 2026
Merged

⭐ Expand Azure resources + scan additional Azure resources as their own platforms#6630
syrull merged 2 commits intomainfrom
tas50/new_azure_platforms

Conversation

@tas50
Copy link
Copy Markdown
Member

@tas50 tas50 commented Feb 15, 2026

This commit adds discovery support for 6 additional Azure resource types as their own scannable platforms, and expands existing resources with new fields and sub-resources.

New Asset Platforms (Discovery)

These Azure resources can now be individually discovered and scanned as standalone assets:

  ┌────────────────────────────────┬──────────────────────┬────────────────────────────┐
  │             Title              │   Discovery Target   │        Platform ID         │
  ├────────────────────────────────┼──────────────────────┼────────────────────────────┤
  │ Azure AKS Cluster              │ aks-clusters         │ azure-aks-cluster          │
  ├────────────────────────────────┼──────────────────────┼────────────────────────────┤
  │ Azure App Service App          │ app-service-webapps  │ azure-app-service-webapp   │
  ├────────────────────────────────┼──────────────────────┼────────────────────────────┤
  │ Azure Cache for Redis Instance │ cache-redis-instances│ azure-cache-redis-instance │
  ├────────────────────────────────┼──────────────────────┼────────────────────────────┤
  │ Azure Batch Account            │ batch-accounts       │ azure-batch-account        │
  ├────────────────────────────────┼──────────────────────┼────────────────────────────┤
  │ Azure Cosmos DB Account        │ cosmosdb             │ azure-cosmosdb             │
  └────────────────────────────────┴──────────────────────┴────────────────────────────┘

Resources Made Public (no longer private)

4 resources were changed from private to public, enabling them to be used as top-level scan targets:

  • azure.subscription.webService.appsite
  • azure.subscription.cosmosDbService.account
  • azure.subscription.aksService.cluster
  • azure.subscription.cacheService.redisInstance

Each of these also gained an init function that resolves by asset ID, enabling platform-level scanning.

New Resources (8)

Web/App Service:

  • azure.subscription.webService.appServicePlan — App Service plans with SKU, zone redundancy, scaling settings (15 fields)
  • azure.subscription.webService.certificate — App Service certificates with thumbprint, issuer, expiration, validity (12 fields)
  • azure.subscription.webService.appsite.hostNameBinding — Hostname bindings with SSL state and thumbprint (6 fields)
  • azure.subscription.webService.appsite.virtualNetworkConnection — VNet connections with Swift/resync status (5 fields)

Cache for Redis:

  • azure.subscription.cacheService.redisInstance.firewallRule — Firewall rules with IP range (5 fields)
  • azure.subscription.cacheService.redisInstance.patchSchedule — Patch schedules with entries (4 fields)
  • azure.subscription.cacheService.redisInstance.privateEndpointConnection — Private endpoint connections with status (6 fields)

New Fields on Existing Resources

azure.subscription.webService (2 new fields):

  • appServicePlans() — list of App Service plans
  • certificates() — list of certificates

azure.subscription.webService.appsite (2 new fields):

  • hostNameBindings() — hostname bindings for the app
  • virtualNetworkConnections() — VNet connections for the app

azure.subscription.cacheService.redisInstance (12 new fields):

  • minimumTlsVersion — minimum TLS version
  • redisConfiguration — configuration settings dict
  • shardCount — number of shards (Premium)
  • staticIp — static IP for VNet-injected caches
  • subnetId — subnet ID for VNet
  • zones — availability zones
  • identity — managed identity info
  • privateEndpointConnections — private endpoint connections
  • firewallRules() — firewall rules
  • patchSchedules() — patch schedules
> azure.subscription.aksService.cluster
azure.subscription.aksService.cluster: azure.subscription.aksService.cluster name="lunalectric-discovery-one-aks" location="westus2" kubernetesVersion="1.31"
> asset.platform
asset.platform: "azure-aks-cluster"
>
> azure.subscription.cacheService.redis
azure.subscription.cacheService.redis: [
  0: azure.subscription.cacheService.redisInstance id="/subscriptions/12345678910/resourceGroups/tim-test_group/providers/Microsoft.Cache/Redis/tas50-redis" hostName="tas50-redis.redis.cache.windows.net"
]
> asset.platform
asset.platform: "azure-cache-redis-instance"
> asset.platform
asset.platform: "azure-app-service-webapp"
> azure.subscription.webService.appsite
azure.subscription.webService.appsite: azure.subscription.webService.appsite id="/subscriptions/e4ef750a-2d3d-477f-aa70-b9d8c8e8d03c/resourceGroups/tim-test_group/providers/Microsoft.Web/sites/tas50-webapp" name="tas50-webapp" location="Canada Central"
> asset.platform
asset.platform: "azure-batch-account"
> azure.subscription.batchService.account
azure.subscription.batchService.account: azure.subscription.batchService.account id="/subscriptions/e4ef750a-2d3d-477f-aa70-b9d8c8e8d03c/resourceGroups/tim-test_group/providers/Microsoft.Batch/batchAccounts/tas50batch" name="tas50batch" location="westus"
> asset.platform
asset.platform: "azure-cosmosdb"
> azure.subscription.cosmosDbService.account
azure.subscription.cosmosDbService.account: azure.subscription.cosmosDbService.account name="tas50-test" kind="GlobalDocumentDB" location="West US 2"

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 15, 2026

Test Results

5 112 tests  +9   5 108 ✅ +9   2m 0s ⏱️ -1s
  409 suites ±0       4 💤 ±0 
   31 files   ±0       0 ❌ ±0 

Results for commit e25a685. ± Comparison against base commit 51341f3.

This pull request removes 1 and adds 10 tests. Note that renamed tests count towards both.
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestAzureSubscriptionCacheServiceRedis/TestEnumConversions
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestAzureSubscriptionCacheServiceRedis/TestNilOptionalFields
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchAccountDataConversion
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchAccountDataConversion/EnumConversions
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchAccountDataConversion/FullDataConversion
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchAccountDataConversion/NilOptionalFields
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchAccountDataConversion/NilProperties
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchPoolDataConversion
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchPoolDataConversion/FullDataConversion
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestBatchPoolDataConversion/NilOptionalFields
go.mondoo.com/mql/v13/providers/azure/resources ‑ TestComponentCaseInsensitive

♻️ This comment has been updated with latest results.

@tas50 tas50 force-pushed the tas50/new_azure_platforms branch from 5edeec0 to 9e8a400 Compare February 15, 2026 00:17
cnquery shell azure <name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
cnspec scan azure compute instance <instance-name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
cnspec scan azure compute snapshot <snapshot-name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
cnquery shell azure <subscription-name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced a tab with the spaces so this renders correctly on the CLI

@tas50 tas50 force-pushed the tas50/new_azure_platforms branch from 9e8a400 to 3e77cac Compare February 15, 2026 03:35
@tas50 tas50 marked this pull request as ready for review February 15, 2026 03:42
@tas50 tas50 force-pushed the tas50/new_azure_platforms branch 6 times, most recently from 5e18c31 to ae334cd Compare February 21, 2026 09:12
@chris-rock
Copy link
Copy Markdown
Member

/review

@mondoo-code-review
Copy link
Copy Markdown

Unable to complete the code review. Please try again or reduce the PR size.

Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-structured expansion of Azure resources with proper error handling and null checking throughout

Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid implementation of Azure resource discovery and expansion — no critical issues found

@tas50 tas50 force-pushed the tas50/new_azure_platforms branch 4 times, most recently from 4492bff to bc5a3be Compare February 23, 2026 16:35
Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-structured expansion following codebase patterns. Verify test helper exists.

Additional findings (file/line not in diff):

  • 🔵 providers/azure/resources/redis.go:139 — The firewallRules() method lacks 404 handling that patchSchedules() has (line 179). If firewall rules might return 404 when not configured, add the same errors.As check for consistency.

aadMode := armbatch.AuthenticationModeAAD
sharedKeyMode := armbatch.AuthenticationModeSharedKey

mockAccount := &armbatch.Account{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 warning — The ptr() helper function is used throughout but not imported. Verify it exists in package test utilities (e.g., common_test.go). If not, add: func ptr[T any](v T) *T { return &v }

@tas50 tas50 force-pushed the tas50/new_azure_platforms branch from bc5a3be to 4dbac6a Compare February 25, 2026 08:09
This commit adds discovery support for 5 additional Azure resource types as their own scannable platforms, and expands existing resources with new fields and sub-resources.

New Asset Platforms (Discovery)

These Azure resources can now be individually discovered and scanned as standalone assets:

  ┌────────────────────────────────┬───────────────────────┬────────────────────────────┐
  │             Title              │   Discovery Target    │        Platform ID         │
  ├────────────────────────────────┼───────────────────────┼────────────────────────────┤
  │ Azure AKS Cluster              │ aks-clusters          │ azure-aks-cluster          │
  ├────────────────────────────────┼───────────────────────┼────────────────────────────┤
  │ Azure App Service App          │ app-service-webapps   │ azure-app-service-webapp   │
  ├────────────────────────────────┼───────────────────────┼────────────────────────────┤
  │ Azure Cache for Redis Instance │ cache-redis-instances  │ azure-cache-redis-instance │
  ├────────────────────────────────┼───────────────────────┼────────────────────────────┤
  │ Azure Batch Account            │ batch-accounts        │ azure-batch-account        │
  ├────────────────────────────────┼───────────────────────┼────────────────────────────┤
  │ Azure Cosmos DB Account        │ cosmosdb              │ azure-cosmosdb             │
  └────────────────────────────────┴───────────────────────┴────────────────────────────┘

Resources Made Public (no longer private)

4 resources were changed from private to public, enabling them to be used as top-level scan targets:

- azure.subscription.webService.appsite
- azure.subscription.cosmosDbService.account
- azure.subscription.aksService.cluster
- azure.subscription.cacheService.redisInstance

Each of these also gained an init function that resolves by asset ID, enabling platform-level scanning.

New Resources (8)

Web/App Service:
- azure.subscription.webService.appServicePlan — App Service plans with SKU, zone redundancy, scaling settings (15 fields)
- azure.subscription.webService.certificate — App Service certificates with thumbprint, issuer, expiration, validity (12 fields)
- azure.subscription.webService.appsite.hostNameBinding — Hostname bindings with SSL state and thumbprint (6 fields)
- azure.subscription.webService.appsite.virtualNetworkConnection — VNet connections with Swift/resync status (5 fields)

Cache for Redis:
- azure.subscription.cacheService.redisInstance.firewallRule — Firewall rules with IP range (5 fields)
- azure.subscription.cacheService.redisInstance.patchSchedule — Patch schedules with entries (4 fields)
- azure.subscription.cacheService.redisInstance.privateEndpointConnection — Private endpoint connections with status (6 fields)

New Fields on Existing Resources

azure.subscription.webService (2 new fields):
- appServicePlans() — list of App Service plans
- certificates() — list of certificates

azure.subscription.webService.appsite (2 new fields):
- hostNameBindings() — hostname bindings for the app
- virtualNetworkConnections() — VNet connections for the app

azure.subscription.cacheService.redisInstance (12 new fields):
- minimumTlsVersion — minimum TLS version
- redisConfiguration — configuration settings dict
- shardCount — number of shards (Premium)
- staticIp — static IP for VNet-injected caches
- subnetId — subnet ID for VNet
- zones — availability zones
- identity — managed identity info
- privateEndpointConnections — private endpoint connections
- firewallRules() — firewall rules
- patchSchedules() — patch schedules

Also fixes inconsistent spacing between discovery blocks in
Discover() and adds version entries for all new resources.

Signed-off-by: Tim Smith <tsmith84@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tas50 tas50 force-pushed the tas50/new_azure_platforms branch from 4dbac6a to 8e4ed33 Compare February 25, 2026 09:03
…D lookup

P1: Replace bare type assertions in init functions with comma-ok pattern
    to prevent panics when Value is nil (aks.go, batch.go, cosmosdb.go,
    redis.go, web.go).

P2: Guard nil runtime in redis.go createRedisInstanceRawData PEC loop
    to prevent panic when called without a plugin runtime.

P2: Normalize resourceID path keys to lowercase at parse-time for
    deterministic Component() lookups (O(1) map access instead of O(n)
    linear scan).

P3: Replace fmt.Errorf with errors.New for static error strings in
    redis.go; remove unused fmt import.
@syrull syrull merged commit 2ebccd3 into main Feb 25, 2026
21 checks passed
@syrull syrull deleted the tas50/new_azure_platforms branch February 25, 2026 12:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants