Hello,
To achieve the functionality you described, you can use an Azure Function App with a custom JavaScript function. The function can use the Azure CLI to update the Inbound Port Rules of your Azure Virtual Machine based on the IP address of the visitor.
Here's an overview of the steps you can take to implement this solution:
1. Create an Azure Function App and a custom function with a JavaScript runtime.
2. Configure the function to execute when the visitor accesses the /temp_url_xxxxxxxxxx.html URL.
3. In the JavaScript function, use a library like Request.js to get the IP address of the visitor.
4. Use the Azure CLI within the JavaScript function to add the IP address to the Inbound Port Rules of your Azure Virtual Machine.
5. Once the IP address has been added, redirect the visitor to your mysite2.com domain.
As for which Azure product to use, an Azure Function App would be a good choice for this scenario. Function Apps are designed to execute small pieces of code in response to specific events or requests. They are lightweight and can scale up or down as needed, which makes them well-suited for handling sporadic requests from visitors.
In contrast, an Azure Web App is better suited for hosting full-fledged web applications or APIs, which is more than what you need for this scenario.
I hope I give you a hint.