A Flask-based web application for simulating Azure Scheduled Events and IMDS (Instance Metadata Service) event flows. This tool is designed for testing and development scenarios where you want to emulate Azure platform events, such as Live Migration, User Reboot, Maintenance, and more.
- Select from multiple predefined scenarios (Live Migration, User Reboot, Redeploy, etc.)
- Manually generate events for each scenario state (Scheduled, Started, Completed, etc.)
- Automatically run a scenario through all its states with realistic timing
- Set custom resources for each event (default:
vmss_vm1) - Endpoint simulates the IMDS endpoint
/metadata/scheduledeventsand can be called from within our outside of the test VM - Supports simulating event approvals via IMDS POST
- Python 3.8+
pip(Python package manager)
-
Clone this repository:
git clone https://github.com/your-org/ScheduledEventsResponder.git cd ScheduledEventsResponder -
Install dependencies:
python -m venv .venv .\.venv\Bin\Activate.ps1 #On PowerShell pip install -r requirements.txt
-
Run the application:
python main.py
-
Open your browser and navigate to http://localhost
-
Select a Scenario
- Use the dropdown at the top of the page to select a scenario (e.g., Live Migration, User Reboot).
- Click Set Scenario to activate it.
-
Set Resources (Optional)
- Under "Run Scenario", enter a comma-separated list of resource names in the Resources field.
- Default is
vmss_vm1.
-
Generate Events Manually
- Select an event status from the dropdown (e.g., Scheduled, Started).
- Click Generate Event to create an event in that state.
-
Automatically Run Scenario
- Click Automatically Run Scenario to progress through all states with realistic timing.
- A countdown timer will appear showing time until the next event state.
-
Stop Playback
- Click Stop Playback to halt automatic progression.
-
View Last Event
- The "Last Event" section displays the most recent event in IMDS format.
-
The app exposes
/metadata/scheduledeventsfor both GET and POST. -
GET returns the current event(s) in IMDS format.
-
POST with a JSON body containing
StartRequestsand a matchingEventIdwill immediately advance the event to the next state (simulating event approval).Example:
curl -H "Metadata:true" -X POST -d '{"StartRequests": [{"EventId": "YOUR_EVENT_ID"}]}' http://localhost:80/metadata/scheduledevents?api-version=2020-07-01
-
For more information on Azure Scheduled Events and the IMDS API, see the Azure Scheduled Events documentation.
There are two types of scenarios available to automatically run. The base types have their timings based on median values from a sample of scheduled events sent to Azure customer in July 2025. These timing can be used to understand how your application would respond to a real event.
The "Dev Timing" scenarios have all the timing reduced by a factor of 60 to make it easier for development and inner loop testing. For example, instead of a 15 minute warning period before the live migration, the scenario will only give 15 seconds. This shouldn't used as a guideline for how Azure will work, but rather as a way to make your development easier.
- A few common scenarios are defined in
main.pyin thescenariosdictionary. - You can add or modify scenarios as needed.
In addition to the browser UI, this project now supports a CLI utility (mockcli) to simulate scheduled events via command line — useful for automation or testing in headless environments.
- Supports triggering all predefined scenarios
- Generates Scheduled → Started → Completed events in order
- Looping and delay support for continuous testing
python tools/mockcli.py --scenario "Live Migration"
python tools/mockcli.py --all
python tools/mockcli.py --loop --interval 30
## Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.