How to report the Obsolete assets in Azure? - azure

I want to send an Email with all the obsolete assets in Azure that are no longer actively used within 3 months. I need to send this email every day. There is no Azure native option available. Am I missing any built-in method which can be used?

AFAIK there is no native way to send such report, so you need to prepare your own solution. This would involve steps:
tag obsolete assets
query all resources with specific tag (Powershell, AzCLI)
process query result to see them as report you like (azure function, logic app)
send report by mail (azure function, logic app)
Example almost ready to use you may find at https://www.blueboxes.co.uk/how-to-create-azure-resource-graph-explorer-scheduled-reports-and-email-alerts

Related

How to add HTTP trigger in Azure Logic Apps

I want add a functionality in my ADF pipeline which will send me email notification in case of failure. On searching the internet, I came to know that Azure Logic Apps helps with this. I am trying to follow below link to achieve this.
https://microsoft-bitools.blogspot.com/2018/03/add-email-notification-in-azure-data.html
I have tried searching up many tutorials, guides and the official docs as well. However, all of them have some templates already there in the Logic Apps Designer. I cannot find the templates and the 'When a HTTP request is received' trigger is also not available in the drop-down.
Please let me know how to proceed.
EDIT :
If you start with a blank Logic App, search for 'HTTP' or 'Request' and select Request.
On the next screen under triggers, select "When a HTTP request is received" and you should be good to go.
EDIT:
It looks like you created a Standard Logic App, which works in a slightly different way. For instance it can contain multiple workflows, which means you create workflows yourself. In the Consumption model, there's one workflow withing a Logic App, so you can open up the editor for that one directly. If there's no explicit reason for you to use Standard, a Consumption Logic App will be easier to work with.
If you really need a Standard Logic App, go to 'Workflows' and create a new workflow:
Then click the newly created workflow to edit it, go to 'Designer' and search for 'HTTP' to add an HTTP trigger:
Here's some information on the Consumption model for Logic Apps:
Resource type
Benefits
Resource sharing and usage
Limits management
Logic App (Consumption) Host environment: Multi-tenant Azure Logic Apps
- Easiest to get started - Pay-for-what-you-use - Fully managed
A single logic app can have only one workflow. Logic apps created by customers across multiple tenants share the same processing (compute), storage, network, and so on.
Azure Logic Apps manages the default values for these limits, but you can change some of these values, if that option exists for a specific limit.
See Resource type and host environment differences for a comparison with the other hosting options.
I was able to solve this. I wasn't able to view a few functionalities because of another error : Functions runtime error Microsoft.WindowsAzure.Storage: Value cannot be null. (Parameter 'connectionString').
AzureWebJobsStorage App Setting was missing which caused the error. I added that and now I can see the triggers and other stuff.
Thanks #rickvdbosch

Posting data to Salesforce from an Azure Function (Is there a connector?)

I've been searching for some time now for a way to interact with our Salesforce org easily through Azure functions and have been coming up dry. I guess where I am confused is that through Azure Logic Apps I can pretty simply connect into Salesforce and post data through them and I assume on their backend they must have some sort of built in connector to Salesforce.
Is this a package somewhere that I can utilize in Azure functions? This would simplify so much of what we are trying to accomplish with some of our integrations.
There isn't a built in Salesforce binding for Azure Functions, but one option you do have is to invoke your Logic Apps workflow from Azure Functions with the relevant payload, which would allow you to leverage all the built in connectors they have.
You don't really need any fancy connector.
For most use cases, you can use the Salesforce REST API:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest.htm
You can use Postman to test this API and get code samples which could easily be adapted to your Function App:
https://www.postman.com/salesforce-developers/workspace/salesforce-developers/collection/12721794-67cb9baa-e0da-4986-957e-88d8734647e2?ctx=documentation
But be careful!
Salesforce limits your API calls and it is very easy to blow these limits.
The naïve approach would be to post one record at a time. Instead, try to collect as many records as possible and post them all at once.
If Salesforce does not need the data immediately, you can build a cache that will store data somewhere else (e.g. a MongoDb) and then periodically forward the data to Salesforce after it has been allowed to accumulate to some threshold quantity and/or a certain amount of time has elapsed.

Get custom events in schedule function azure app insights

I have to get all custom events that contain certain string on the name, with a scheduled Azure function.
Ideally I would like to send an email if a specific custom event have some wrong data.
The built in alerting features don't let you do this (run an arbitrary query and alert if some specific condition)
However, a lot of people are using Microsoft Flow, and there's some example scenarios there.
Other people have created azure functions to do similar.

How to run azure function deployed on portal manually via Kudu Api dynamically?

I have a time trigger azure function deployed on portal. It runs daily at 10:00 am. However, there is now a requirement that function should also be invoked and run on some other time dynamically as well.
I know how to set the trigger in function.json file dynamically via Kudu Api using the steps in answer mentioned here. So using those steps, I can set the trigger for the next minute and run the function.
But this isn't real-time, this seems a workaround. Isn't there any direct way to invoke and manually run azure function directly via apis?
Isn't there any direct way to invoke and manually run azure function directly via apis?
We could trigger the deployed Azure function with REST API. I test it with Time Trigger C# Azure function on my side.
Post https://{FunctionAppName}.azurewebsites.net/admin/functions/{functionName}
Note: I trace it from Azure portal, I don't find any official document mentioned this, if you want to use this API in the product environment, please pay more attention to this.
We need x-functions-key as header. And we could get the function key from the function Application.
We also could use bearer token as authorization, about how to get the authorization for this Rest API please refer to another SO thread.
Updated:
Add the body info.
For the requirement above, my recommendation would be to create two functions that share the same logic (if CSX, either by importing the common implementation using #load or adding a reference to a common assembly, or by having a common type).
You'd have one function using a timer trigger and another using a different trigger type that enables you to invoke the function on demand without a dependency on any of the Kudu or Admin APIs (e.g. HTTP, queue, SB, etc.), the function entry point (your Run method) would just invoke the common logic you bring in.

Using Azure WebJobs for on demand responses

I currently have a couple of WebApi projects that use a few class libraries such as address lookup, bank validation, image storage etc.
Currently they are all in a shared solution but I'm planning to split them up. I thought about moving the libraries into NuGet packages so that they are separate from the API projects and is properly shared.
However, if I make a change to one of these components I will need to build and redeploy the API service even though it's a separate component which has changed.
I thought about putting these components into a separate service but seems a bit of overhead for what it is.
I've been looking at Azure WebJobs and think I may be able to move these components into this instead. I have two questions related to this:
Are WebJobs suitable for calling on demand (not using a queue)? The request will be activated from a user on a web site which calls my API service which then calls the Web Job so it needs to be quick.
Can a WebJob return data? I've seen examples where it does some processing and updates a database but I need a response (ideally Json) back to my API service.
Thanks
According to your requirement, I assume that you could try to leverage Azure Functions by creating a function using the HTTP trigger, which could be triggered by accessing the Function URL with parameters and return the response as you expected. You could follow this tutorial for getting started with Azure Functions.

Resources