russlank/azure-survey
GitHub: russlank/azure-survey
一个基于 Go 的 Azure 清单 CLI 工具,能够导出订阅快照并生成 Markdown 格式的安全与治理风险报告。
Stars: 1 | Forks: 2
# Azure 调查
[](https://github.com/russlank/azure-survey/releases/latest)
[](https://opensource.org/licenses/MIT)
[](https://buymeacoffee.com/russlank)
`azure-survey` 是一个基于 Go 的 Azure 清单工具,能够导出订阅快照,并生成人类可读的 Markdown 发现报告。
项目主页: [russlank/azure-survey](https://github.com/russlank/azure-survey)
维护者: [Russlan Kafri](https://github.com/russlank)
## 快速导航
| 主题 | 文件 |
|---|---|
| 架构 | [doc/architecture.md](doc/architecture.md) |
| 配置 | [doc/configuration.md](doc/configuration.md) |
| 操作手册 | [doc/operations-run.md](doc/operations-run.md) |
| 测试指南 | [doc/testing-guide.md](doc/testing-guide.md) |
| CI 流水线 | [doc/ci-pipeline.md](doc/ci-pipeline.md) |
| 兼容性说明 | [doc/compatibility-notes.md](doc/compatibility-notes.md) |
| 报告参考 | [doc/report-reference.md](doc/report-reference.md) |
| 入门指引 | [doc/onboarding.md](doc/onboarding.md) |
## 功能特性
- 将 Azure 订阅清单快照导出为带时间戳的 JSON 工件树。
- 根据快照生成 Markdown 发现报告(在线 `run` 流程和离线 `report` 流程)。
- 通过确定性且经过测试的报告渲染,揭示部署和治理风险信号。
当前深入的报告覆盖内容包括:
- API 网关(APIM 服务和 API)
- 关键平台服务的防火墙与 ACL 状态
- 三态暴露分类(`Open`、`Restricted`、`Unknown`)
- 数据完整性与置信度说明
- 虚拟网络关系(VNet/子网/NSG/私有端点/公共 IP/Azure Firewall/Application Gateway)
- Azure SQL 资产(服务器、数据库、弹性池、防火墙规则)
- Cosmos DB 账户
## 构建前置条件
- Go `1.26`(参见 `go.mod`)
- Azure CLI(`az`)用于导出/运行命令
- 经过身份验证的 Azure 上下文,用于实时清单操作
准备 Azure CLI:
```
az --version
az login
az account set --subscription ""
```
## 构建与测试
```
make fmt
make vet
make test
make build
```
构建跨平台发布工件:
```
make dist
```
这将生成:
```
dist/azure-survey-linux-amd64
dist/azure-survey-linux-arm64
dist/azure-survey-windows-amd64.exe
dist/SHA256SUMS
```
仅在有意更改报告输出时刷新报告基准文件:
```
AZU_UPDATE_GOLDEN=1 go test ./internal/inventory/report -run TestServiceRun_GoldenFixtures -count=1
```
## 命令行工具
```
azure-survey inventory run [flags]
azure-survey inventory export [flags]
azure-survey inventory report [flags]
azure-survey version
azure-survey help
```
## 快速使用
```
./dist/azure-survey inventory run \
--subscription-id "" \
--output-root "artifacts/azure-inventory"
./dist/azure-survey inventory export \
--subscription-id "" \
--output-root "artifacts/azure-inventory" \
--activity-log-days 30
./dist/azure-survey inventory report \
--inventory-root "artifacts/azure-inventory" \
--subscription-id ""
```
## 项目结构
```
azure-survey/
├── .github/workflows/ci.yml # GitHub Actions CI + release pipeline
├── .woodpecker.yml # Woodpecker CI + release pipeline
├── cmd/azure-survey/ # CLI entrypoint
├── internal/ # application packages
├── testdata/ # fixtures and golden outputs
├── doc/ # project documentation
├── scripts/ # helper scripts
├── Makefile
└── go.mod
```
## 持续集成与发布
- GitHub Actions 工作流: `.github/workflows/ci.yml`
- Woodpecker 工作流: `.woodpecker.yml`
- 两条流水线均执行相同的质量门禁(`gofmt`、`go vet`、`go test`、`make dist`)
- 带有标签的发布(`v*`)会将发布工件发布到 GitHub Releases
## 版本管理
使用语义化版本管理:`vMAJOR.MINOR.PATCH`。
## 许可协议
MIT — 参见 [LICENSE](LICENSE)。
## 支持
如果本项目对您有帮助,您可以通过以下地址支持其持续维护:
- [请我喝杯咖啡](https://buymeacoffee.com/russlank)
标签:API网关, Azure, CLI, EVTX分析, Go, Homebrew安装, Markdown报告, Ruby工具, WiFi技术, 云治理, 云资产清单, 人工智能安全, 合规性, 安全报告, 快照导出, 攻击面分析, 日志审计, 暴露分类, 流量捕获, 清单导出, 网络拓扑, 订阅快照, 运维审计, 逆向工程, 防御加固, 防火墙策略