Home > Back-end >  Azure az copy command complete event grid notification
Azure az copy command complete event grid notification

Time:07-30

Is there a way for the Azure event grid to trigger when an AZ copy command completes?

We have clients which use az copy to transfer hundreds of files and sub folders into our Azure storage. The number of files is variable. And the az copy command is of a single root folder on their local containing those files and sub folders.

We want to raise an event grid notification when the az copy is complete and successful.

An alternative would be to have a second az copy command in a batch file that transfers a single flag file once the initial command is fully executed successfully. We would then monitor for this single file as the flag to proceed with further processing.

Perhaps if az copy cannot raise the event, then it can add a verification file signaling the end of the transfer?

CodePudding user response:

You can have event grid notifications on an individual blob (or directory, when using ADLS). azcopy is essentially creating individual blobs, so you'd get individual notifications. Azure storage doesn't provide a transactional batch of uploads, so you can't get a single notifiction.

If you wanted a single notification, you'd have to manage this yourself. You mentioned a "flag" file, but you can also create custom topics, use an Azure Function, service bus message, etc. How you ultimately implement this is up to you (and your clients that are uploading content), but tl;dr no, you can't get a single completion event for a batch of uploads.

CodePudding user response:

I have tried to reproduce in my environment get notification successfully

For event grid notification the endpoint which will receive notification in function app or logic apps...I created endpoint in function app

In your function app -> Function -> create ->select azure event grid trigger ->create enter image description here

once created, in storage account create subscription as below

enter image description here

please make changes as below once you select endpoint by default it shows function in right side as below and confirm selection and create subscription

enter image description here

once azcopy is complete and files uploaded in container you will get a notification like below

enter image description here

  • Related