cloud-custodian / cloud-custodian

Rules engine for cloud security, cost optimization, and governance, DSL in yaml for policies to query, filter, and take actions on resources
https://cloudcustodian.io
Apache License 2.0
5.45k stars 1.48k forks source link

Azure EventGrid execution mode takes long time to respond #7546

Open avishayil opened 2 years ago

avishayil commented 2 years ago

Discussed in https://github.com/orgs/cloud-custodian/discussions/7545

Originally posted by **avishayil** July 4, 2022 Hi, so I think that this is more a design question / issue. I'm trying to think about the correct implementation method on Azure, let's say I have the following policy in place (From the examples): ```` - name: azure-auto-tag-creator resource: azure.armresource mode: type: azure-event-grid events: ['VmWrite', 'StorageWrite'] description: | Tag all new VMs and StorageAccounts with the 'Creator Email' tag. Note: 'resource-type' filter is not required because policy is not triggered by other resources. actions: - type: auto-tag-user tag: CreatorEmail ```` So I noticed in the activity log of the storage account, that the operation took almost 10 minutes: ![Screen Shot 2022-07-04 at 12 59 00](https://user-images.githubusercontent.com/827024/177138410-b9817c7a-ecd2-420e-bfee-140a52dcce8a.png) Why is this taking so long? What causes the delay? - Is it the API operation completion? - EventGrid subscription? - Function app warmup? - Function app polling the queue? - Function app operation? - Activity log updates? Would love to get clarifications as I hoped for a near realtime operation in EvetGrid execution mode
kapilt commented 2 years ago

ping @cloud-custodian/azure