cartography
cartography copied to clipboard
feat(azure): Add Azure network interface and public IP ingestion
Summary
Add support for Azure Network Interfaces and Public IP Addresses to enable discovery of VMs with public IPs.
New nodes:
AzureNetworkInterface- Network interface cards attached to VMsAzurePublicIPAddress- Public IP addresses in Azure
New relationships:
(AzureNetworkInterface)-[:ATTACHED_TO]->(AzureVirtualMachine)- NIC attached to VM(AzureNetworkInterface)-[:ATTACHED_TO]->(AzureSubnet)- NIC connected to subnet(AzureNetworkInterface)-[:ASSOCIATED_WITH]->(AzurePublicIPAddress)- NIC has public IP(AzureSubscription)-[:RESOURCE]->(AzureNetworkInterface)- Subscription contains NIC(AzureSubscription)-[:RESOURCE]->(AzurePublicIPAddress)- Subscription contains Public IP
Example query to find all VMs with public IPs:
MATCH (pip:AzurePublicIPAddress)<-[:ASSOCIATED_WITH]-(nic:AzureNetworkInterface)-[:ATTACHED_TO]->(vm:AzureVirtualMachine)
RETURN pip.ip_address, pip.name, vm.name, vm.id
Implementation notes:
- The Azure SDK's
.as_dict()method returns properties in a flattened structure (not nested underproperties). The transform functions handle both formats for robustness.
Related issues or links
Closes #2126
Checklist
Provide proof that this works (this makes reviews move faster). Please perform one or more of the following:
- [x] Update/add unit or integration tests.
- [ ] Include a screenshot showing what the graph looked like before and after your changes.
- [ ] Include console log trace showing what happened before and after your changes.
If you are changing a node or relationship:
If you are implementing a new intel module:
- [x] Use the NodeSchema data model.
- [x] Confirm that the linter actually passes (submitting a PR where the linter fails shows reviewers that you did not test your code and will delay your review).