Skip to content

[WIP] Add AKS module to Azure provider - #4

Open
austinsonger with Copilot wants to merge 3 commits into
mainfrom
copilot/add-aks-module
Open

[WIP] Add AKS module to Azure provider#4
austinsonger with Copilot wants to merge 3 commits into
mainfrom
copilot/add-aks-module

Conversation

Copilot AI commented May 15, 2026

Copy link
Copy Markdown
  • Add Azure feature flags + dependencies to Cargo.toml
  • Create src/providers/mod.rs (CloudProvider enum)
  • Create src/providers/azure/mod.rs (module declarations)
  • Create src/providers/gcp/mod.rs (stub)
  • Create src/providers/azure/factory.rs (AzureProviderFactory)
  • Create src/providers/azure/aks.rs (AKS CsvCollector)
  • Create src/providers/azure/acr.rs (ACR CsvCollector)
  • Create src/providers/azure/app_service.rs (App Service CsvCollector)
  • Create src/providers/azure/defender.rs (Defender CsvCollector)
  • Create src/providers/azure/key_vault.rs (Key Vault JsonCollector)
  • Create src/providers/azure/policy.rs (Policy JsonCollector)
  • Create src/providers/azure/nsg.rs (NSG CsvCollector)
  • Create src/providers/azure/monitor_alerts.rs (Monitor Alerts CsvCollector)
  • Update src/evidence.rs (add Azure/GCP EvidenceSource variants)
  • Update src/app_config.rs (add Azure fields)
  • Update src/main.rs (add mod providers;)
  • cargo check --features azure passes
  • cargo build (no features) passes (regression check)
Original prompt
      .unwrap_or(0);
            let rg = cluster.id.as_deref()
                .and_then(|id| id.split("/resourceGroups/").nth(1))
                .and_then(|s| s.split('/').next())
                .unwrap_or("")
                .to_string();

            rows.push(vec![
                cluster.name.clone().unwrap_or_default(),
                rg,
                cluster.location.clone().unwrap_or_default(),
                props.and_then(|p| p.kubernetes_version.clone()).unwrap_or_default(),
                props.and_then(|p| p.provisioning_state.clone()).unwrap_or_default(),
                props.and_then(|p| p.enable_rbac)
                    .map(|b| b.to_string())
                    .unwrap_or_default(),
                node_count.to_string(),
            ]);
        }
    }

    Ok(rows)
}

}


- [ ] **Step 2: Add `pub mod aks;` to `src/providers/azure/mod.rs`**

- [ ] **Step 3: Wire into `AzureProviderFactory::csv_collectors()`**

```rust
use crate::providers::azure::aks::AksCollector;

if self.is_selected("azure-aks") {
    out.push(Box::new(AksCollector::new(
        Arc::clone(&self.credential),
        self.subscription_id.clone(),
    )));
}
  • Step 4: Compile check and commit
git add src/providers/azure/aks.rs src/providers/azure/mod.rs \
        src/providers/azure/factory.rs
git commit -m "feat(azure): add AKS CsvCollector (maps to EKS)"

Task 10: acr — Azure Container Registry

Maps to: AWS ECR (CsvCollector)

Files:

  • Create: src/providers/azure/acr.rs
  • Modify: src/providers/azure/mod.rs
  • Modify: src/providers/azure/factory.rs

Uses azure_mgmt_containerregistry.

  • Step 1: Create src/providers/azure/acr.rs
use std::sync::Arc;

use anyhow::{Context, Result};
use async_trait::async_trait;
use azure_identity::DefaultAzureCredential;
use azure_mgmt_containerregistry::Client as AcrClient;

use crate::evidence::CsvCollector;

pub struct AcrCollector {
    client:          AcrClient,
    subscription_id: String,
}

impl AcrCollector {
    pub fn new(credential: Arc<DefaultAzureCredential>, subscription_id: String) -> Self {
        Self {
            client: AcrClient::new(Arc::clone(&credential)),
            subscription_id,
        }
    }
}

#[async_trait]
impl CsvCollector for AcrCollector {
    fn name(&self) -> &str { "Azure Container Registry" }
    fn filename_prefix(&self) -> &str { "Azure_Container_Registries" }

    fn headers(&self) -> &'static [&'static str] {
        &[
            "Registry Name",
            "Resource Group",
            "Location",
            "SKU",
            "Admin User Enabled",
            "Login Server",
            "Provisioning State",
        ]
    }

    async fn collect_rows(
        &self,
        _account_id: &str,
        _region: &str,
        _dates: Option<(i64, i64)>,
    ) -> Result<Vec<Vec<String>>> {
        let mut rows = Vec::new();

        let mut stream = self.client
            .registries_client()
            .list(&self.subscription_id)
            .into_stream();

        while let Some(page) = futures::StreamExt::next(&mut stream).await {
            let page = page.context("ACR: list page failed")?;
            for reg in page.value {
                let props = reg.properties.as_ref();
                let rg = reg.id.as_deref()
                    .and_then(|id| id.split("/resourceGroups/").nth(1))
                    .and_then(|s| s.split('/').next())
                    .unwrap_or("")
                    .to_string();

                rows.push(vec![
                    reg.name.clone().unwrap_or_default(),
                    rg,
                    reg.location.clone().unwrap_or_default(),
                    reg.sku.as_ref()
                        .and_then(|s| s.name.as_ref())
                        .map(|n| format!("{:?}", n))
                        .unwrap_or_default(),
                    props.and_then(|p| p.admin_user_enabled)
                        .map(|b| b.to_string())
                        .unwrap_or_default(),
                    props.and_then(|p| p.login_server.clone()).unwrap_or_default(),
                    props.and_then(|p| p.provisioning_state.as_ref())
                        .map(|s| format!("{:?}", s))
                        .unwrap_or_default(),
                ]);
            }
        }

        Ok(rows)
    }
}
  • Step 2: Add pub mod acr; to src/providers/azure/mod.rs

  • Step 3: Wire into AzureProviderFactory::csv_collectors()

use crate::providers::azure::acr::AcrCollector;

if self.is_selected("azure-acr") {
    out.push(Box::new(AcrCollector::new(
        Arc::clone(&self.credential),
        self.subscription_id.clone(),
    )));
}
  • Step 4: Compile check and commit
git add src/providers/azure/acr.rs src/providers/azure/mod.rs \
        src/providers/azure/factory.rs
gi...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

Created from [VS Code](https://code.visualstudio.com/docs/copilot/copilot-coding-agent).

Agent-Logs-Url: https://github.com/austinsonger/the-grabber/sessions/b02481d8-2f74-4289-b261-b1b86d69071a

Co-authored-by: austinsonger <26654315+austinsonger@users.noreply.github.com>
@austinsonger

Copy link
Copy Markdown
Owner

@copilot Resolves MErge Conflicts

@austinsonger

Copy link
Copy Markdown
Owner

@codex[agent] Resolves MErge Conflicts

@Codex

Codex AI commented Jul 10, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 35ff71a4-638e-44c5-ae58-b8fe74adfe7a

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 35ff71a4-638e-44c5-ae58-b8fe74adfe7a

4 similar comments
@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 35ff71a4-638e-44c5-ae58-b8fe74adfe7a

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 35ff71a4-638e-44c5-ae58-b8fe74adfe7a

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 35ff71a4-638e-44c5-ae58-b8fe74adfe7a

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 35ff71a4-638e-44c5-ae58-b8fe74adfe7a

@austinsonger

Copy link
Copy Markdown
Owner

@copilot Resolves MErge Conflicts

@austinsonger

Copy link
Copy Markdown
Owner

@codex[agent] Resolves MErge Conflicts

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0fdd33ee-cf6d-42c9-a3ad-a0e58d5c4049

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0fdd33ee-cf6d-42c9-a3ad-a0e58d5c4049

1 similar comment
@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0fdd33ee-cf6d-42c9-a3ad-a0e58d5c4049

@austinsonger
austinsonger requested a review from Copilot July 11, 2026 00:04
@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0fdd33ee-cf6d-42c9-a3ad-a0e58d5c4049

1 similar comment
@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0fdd33ee-cf6d-42c9-a3ad-a0e58d5c4049

@Codex

Codex AI commented Jul 11, 2026

Copy link
Copy Markdown

@austinsonger The model is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0fdd33ee-cf6d-42c9-a3ad-a0e58d5c4049

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces an initial multi-cloud “providers” layer with an Azure provider (feature-gated) and several Azure collectors (AKS, ACR, App Service, Defender, Key Vault, Policy, NSG, Monitor Alerts), plus config and evidence enum extensions to start supporting non-AWS sources.

Changes:

  • Adds an azure Cargo feature with optional Azure SDK dependencies and a new src/providers/ module tree.
  • Implements multiple Azure CsvCollector/JsonCollector modules and an AzureProviderFactory to construct them.
  • Extends config/evidence enums to include Azure/GCP concepts (provider tag + new EvidenceSource variants).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Cargo.toml Adds azure feature and Azure SDK optional dependencies.
src/main.rs Declares mod providers; to include the new providers module.
src/providers/mod.rs Adds CloudProvider enum and feature-gated provider submodules.
src/providers/gcp/mod.rs Adds a stub GCP provider module.
src/providers/azure/mod.rs Declares Azure collector submodules.
src/providers/azure/factory.rs Adds AzureProviderFactory to build selected Azure collectors.
src/providers/azure/aks.rs Adds AKS collector using Azure ARM REST API via azure_core.
src/providers/azure/acr.rs Adds ACR collector (currently has compile-time issues).
src/providers/azure/app_service.rs Adds App Service collector.
src/providers/azure/defender.rs Adds Defender for Cloud assessments collector.
src/providers/azure/key_vault.rs Adds Key Vault JSON collector.
src/providers/azure/policy.rs Adds Policy compliance JSON collector.
src/providers/azure/nsg.rs Adds NSG + rules CSV collector.
src/providers/azure/monitor_alerts.rs Adds Monitor metric alert rules CSV collector.
src/evidence.rs Adds Azure/GCP EvidenceSource variants.
src/app_config.rs Adds provider plus Azure account fields (tenant/subscription).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/providers/azure/acr.rs
Comment thread src/providers/azure/acr.rs
Comment thread src/app_config.rs
Comment on lines +103 to +105
/// Cloud provider for this account entry. Defaults to `aws`.
#[serde(default = "default_provider")]
pub provider: CloudProvider,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure

4 participants