Hi @ja ,
Thanks for posting your query in Q&A.
In order to recommend a solution for your requirement, we need to understand the configuration of alerts. I looked into the Azure machine learning compute and the resource doesnt provide a signal related to cost/pricing. Alerts can only be triggered based on the resource's capacity utilization/errors/outage/custom logs. I am not sure if there is a way to send alert whenever a resource exceeds a particular limit. If there is a way to alert, then there is no need to pass susbcription and resource group to function app as you can only configure alerts to the function app that is present in the same subscription as that of the Machine learning compute resource. Also, a payload cannot be passed to the Function app from Alerts as it can only trigger the function.
If there is no way to send an alert for cost/price, then you need to identify an appropriate trigger for the Function app. Maybe a timer trigger function would keep checking the resources every week/day/hour. If you are using a timer trigger, then you can list out the subscriptions associated with the service principal used by function app using the REST api. Also please refer to the Azure Machine learning compute's REST API documentation. You can figure out the cost and stop the resource using this REST api.
Hope this helps! Feel free to reach out to me if you have any queries or concerns.