Search code examples
azureazure-devopsazure-active-directoryazure-automation

Export a CSV from Azure Automation to Microsoft Teams instead of blob storage?


I am attempting to run a daily report with Azure Automation that will produce a CSV. Per Microsoft's documentation this report can be exported to Azure blob storage. However I was curious if it is possible to skip that and export it straight to Microsoft Teams. Per some articles I am reading it is possible, but nobody provides a complete set of instructions.

Would anyone be able to help point me in the right direction for this?


Solution

  • Firstly, you need to send the csv file to OneDrive or SharePoint site.

    You can send the link of the OneDrive or SharePoint link to teams via below commands/process, and I followed Microsoft-Document-1 and Microsoft-Document-2:

    Secondly, I opened my Teams Channel and right click on channel and the clicked-on Connectors as below:

    enter image description here

    Then you need to add Incoming Webhook: enter image description here

    Then Click on Configure Incoming Webhook Configure and the type the necessary fields and then click on create. Then copy the url of webhook and paste in $myTeamsWebHook below commands:

    $myTeamsWebHook = "https://microsoft.webhook.office.com/webhookb2/0a2b3bc0-fb46-4401-ad40-51b19omingWebhook/6493f5388bffd69184/c977856c-f4bf-449d8"
    Invoke-RestMethod -Method post -ContentType 'Application/Json'  -Body '{"text":"https://ms.portal.azure.com/#home"}' -Uri $myTeamsWebHook
    

    Output:

    Now link has been delivered as message in Teams:

    enter image description here

    As an example I am sharing azure portal link, there you can share your Onedrive or sharepoint link.

    What I usually follow is sending to Storage Account then getting it from there to teams.