Skip to content

Commit 2d711f3

Browse files
committed
Expand Azure provider using fields in new SDKs
The new SDKs unlock new fields outside the mega properties dict. We should use those as they are more discoverable and we control the stability longterm. Signed-off-by: Tim Smith <tsmith84@gmail.com>
1 parent fa36507 commit 2d711f3

File tree

12 files changed

+2772
-156
lines changed

12 files changed

+2772
-156
lines changed

.github/actions/spelling/expect.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
aad
12
ACCOUNTADMIN
2-
Adddays
3+
advancedthreatprotection
34
antispam
45
appslot
56
atlassian
@@ -12,11 +13,11 @@ awslogs
1213
awsvpc
1314
backupconfiguration
1415
backupsetting
16+
backupshorttermretentionpolicy
1517
bigquery
1618
bytematchstatement
1719
cavium
1820
cdn
19-
cea
2021
certificatechains
2122
clcerts
2223
cloudflare
@@ -27,7 +28,6 @@ copywrite
2728
cpe
2829
cryptokey
2930
ctx
30-
CUSTOMERID
3131
customresources
3232
cyclonedx
3333
dast
@@ -58,7 +58,6 @@ gcfs
5858
gcs
5959
geomatchstatement
6060
gistfile
61-
googleworkplace
6261
gotestsum
6362
gpu
6463
groupname
@@ -79,16 +78,15 @@ iotedge
7978
ipc
8079
ipsetforwardedipconfig
8180
ipsetreferencestatement
82-
isdir
8381
istio
8482
jira
8583
jsonbody
86-
kexts
8784
kqueue
8885
labelmatchstatement
8986
lfs
9087
liveanalytics
9188
loggingservice
89+
longtermretentionpolicy
9290
lsp
9391
manageddevice
9492
managedrulegroupstatement
@@ -122,7 +120,6 @@ OIDs
122120
ondemand
123121
opcplc
124122
opensearch
125-
openssh
126123
openssl
127124
orstatement
128125
ospf
@@ -173,6 +170,8 @@ testutils
173170
timestream
174171
toplevel
175172
tpu
173+
serviceconnection
174+
Vnet
176175
udid
177176
Uocm
178177
usb
@@ -182,12 +181,11 @@ vdcs
182181
virtualmachine
183182
vlans
184183
vrf
185-
Vtpm
184+
vtpm
186185
vulnerabilityassessmentsettings
187186
vulnmgmt
188187
webide
189188
WEBSERVERS
190189
wil
191-
xoxp
192190
xssmatchstatement
193191
zrt

CLAUDE.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,6 @@ go test -v ./providers/core/...
189189

190190
Step 3 is the core of the work here (e.g. doing the ticket's local dev work). The start and end should wrap 3.
191191
192-
### Performance Monitoring with Prometheus and Grafana
193-
When debugging performance issues, you can monitor memory and CPU usage:
194-
1. Install Prometheus (macOS: `brew install prometheus`)
195-
2. Start monitoring stack: `make metrics/start`
196-
3. Configure Grafana at http://localhost:3000 (one-time setup):
197-
- Add Prometheus data source (URL: `http://host.docker.internal:9009`)
198-
- Import a Go profiling dashboard (e.g., Grafana dashboard #10826)
199-
4. Run mql with metrics enabled: `DEBUG=1 mql run local -c "asset"`
200-
201192
### Remote Debugging
202193
For providers that need to run on specific VMs (e.g., GCP snapshot scanning):
203194
1. Install Go and Delve on the remote VM

providers/azure/resources/aks.go

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ func (a *mqlAzureSubscriptionAksServiceCluster) id() (string, error) {
3939
return a.Id.Data, nil
4040
}
4141

42+
func (a *mqlAzureSubscriptionAksServiceClusterAadProfile) id() (string, error) {
43+
return a.Id.Data, nil
44+
}
45+
46+
func (a *mqlAzureSubscriptionAksServiceClusterAutoUpgradeProfile) id() (string, error) {
47+
return a.Id.Data, nil
48+
}
49+
4250
func (a *mqlAzureSubscriptionAksService) clusters() ([]any, error) {
4351
conn := a.MqlRuntime.Connection.(*connection.AzureConnection)
4452
ctx := context.Background()
@@ -127,6 +135,66 @@ func (a *mqlAzureSubscriptionAksService) clusters() ([]any, error) {
127135
}
128136
}
129137

138+
var defenderEnabled, imageCleanerEnabled, workloadIdentityEnabled, azureKeyVaultKmsEnabled *bool
139+
var imageCleanerIntervalHours *int32
140+
var azureKeyVaultKmsNetworkAccess *string
141+
if entry.Properties.SecurityProfile != nil {
142+
sp := entry.Properties.SecurityProfile
143+
if sp.Defender != nil && sp.Defender.SecurityMonitoring != nil {
144+
defenderEnabled = sp.Defender.SecurityMonitoring.Enabled
145+
}
146+
if sp.ImageCleaner != nil {
147+
imageCleanerEnabled = sp.ImageCleaner.Enabled
148+
imageCleanerIntervalHours = sp.ImageCleaner.IntervalHours
149+
}
150+
if sp.WorkloadIdentity != nil {
151+
workloadIdentityEnabled = sp.WorkloadIdentity.Enabled
152+
}
153+
if sp.AzureKeyVaultKms != nil {
154+
azureKeyVaultKmsEnabled = sp.AzureKeyVaultKms.Enabled
155+
azureKeyVaultKmsNetworkAccess = (*string)(sp.AzureKeyVaultKms.KeyVaultNetworkAccess)
156+
}
157+
}
158+
159+
// Create AAD Profile sub-resource
160+
var aadProfileData *llx.RawData = llx.NilData
161+
if entry.Properties.AADProfile != nil {
162+
aadP := entry.Properties.AADProfile
163+
adminGroupObjectIDs := []any{}
164+
for _, gid := range aadP.AdminGroupObjectIDs {
165+
if gid != nil {
166+
adminGroupObjectIDs = append(adminGroupObjectIDs, *gid)
167+
}
168+
}
169+
aadRes, err := CreateResource(a.MqlRuntime, "azure.subscription.aksService.cluster.aadProfile",
170+
map[string]*llx.RawData{
171+
"id": llx.StringData(*entry.ID + "/aadProfile"),
172+
"managed": llx.BoolDataPtr(aadP.Managed),
173+
"enableAzureRBAC": llx.BoolDataPtr(aadP.EnableAzureRBAC),
174+
"adminGroupObjectIDs": llx.ArrayData(adminGroupObjectIDs, types.String),
175+
})
176+
if err != nil {
177+
return nil, err
178+
}
179+
aadProfileData = llx.ResourceData(aadRes, "azure.subscription.aksService.cluster.aadProfile")
180+
}
181+
182+
// Create Auto-Upgrade Profile sub-resource
183+
var autoUpgradeProfileData *llx.RawData = llx.NilData
184+
if entry.Properties.AutoUpgradeProfile != nil {
185+
aup := entry.Properties.AutoUpgradeProfile
186+
autoUpgradeRes, err := CreateResource(a.MqlRuntime, "azure.subscription.aksService.cluster.autoUpgradeProfile",
187+
map[string]*llx.RawData{
188+
"id": llx.StringData(*entry.ID + "/autoUpgradeProfile"),
189+
"upgradeChannel": llx.StringDataPtr((*string)(aup.UpgradeChannel)),
190+
"nodeOSUpgradeChannel": llx.StringDataPtr((*string)(aup.NodeOSUpgradeChannel)),
191+
})
192+
if err != nil {
193+
return nil, err
194+
}
195+
autoUpgradeProfileData = llx.ResourceData(autoUpgradeRes, "azure.subscription.aksService.cluster.autoUpgradeProfile")
196+
}
197+
130198
mqlAksCluster, err := CreateResource(a.MqlRuntime, "azure.subscription.aksService.cluster",
131199
map[string]*llx.RawData{
132200
"id": llx.StringDataPtr(entry.ID),
@@ -155,6 +223,16 @@ func (a *mqlAzureSubscriptionAksService) clusters() ([]any, error) {
155223
"disableRunCommand": llx.BoolDataPtr(disableRunCommand),
156224
"apiServerAuthorizedIPRanges": llx.ArrayData(apiServerAuthorizedIPRanges, types.String),
157225
"privateDnsZone": llx.StringDataPtr(privateDnsZone),
226+
"defenderEnabled": llx.BoolDataPtr(defenderEnabled),
227+
"imageCleanerEnabled": llx.BoolDataPtr(imageCleanerEnabled),
228+
"imageCleanerIntervalHours": llx.IntDataDefault(imageCleanerIntervalHours, 0),
229+
"workloadIdentityEnabled": llx.BoolDataPtr(workloadIdentityEnabled),
230+
"azureKeyVaultKmsEnabled": llx.BoolDataPtr(azureKeyVaultKmsEnabled),
231+
"azureKeyVaultKmsNetworkAccess": llx.StringDataPtr(azureKeyVaultKmsNetworkAccess),
232+
"disableLocalAccounts": llx.BoolDataPtr(entry.Properties.DisableLocalAccounts),
233+
"publicNetworkAccess": llx.StringDataPtr((*string)(entry.Properties.PublicNetworkAccess)),
234+
"aadProfile": aadProfileData,
235+
"autoUpgradeProfile": autoUpgradeProfileData,
158236
})
159237
if err != nil {
160238
return nil, err

0 commit comments

Comments
 (0)