This repository contains .NET samples for Azure Compute Schedule operations such as create, start, deallocate, delete, hibernate, and Flex create.
The samples are intentionally small and focused. Each project folder represents a self-contained sample and may use its own configuration pattern depending on the scenario it demonstrates.
| Project | What it demonstrates |
|---|---|
ExecuteCreate |
Standard VM create flow with network and disk setup |
ExecuteCreateFlex |
Flex create flow with API and batch demo modes |
ExecuteStart |
Start existing VMs |
ExecuteDeallocate |
Deallocate existing VMs |
ExecuteDelete |
Delete existing VMs |
ExecuteHibernate |
Hibernate existing VMs |
OperationFallback |
Retry and fallback scenarios for start, hibernate, and create operations |
AllScenarios |
Combined example flow using shared helpers |
- .NET 10 SDK
- An Azure subscription
- An existing Azure resource group
- Azure CLI installed and signed in with
az login - NuGet feeds configured through
src/NuGet.config
DefaultAzureCredential is used throughout the samples, so az login is the simplest way to authenticate locally.
git clone https://github.com/Azure/azure-computeschedule-dotnet-samples.git
cd azure-computeschedule-dotnet-samplesaz loginReview the project folder for the sample you want to run and apply the configuration model documented there.
Depending on the sample, that may involve:
- setting environment variables or a local
.envfile - updating
appsettings.json - updating sample values in
Program.cs - replacing sample VM names, resource IDs, subscription IDs, or resource group names
Sample-specific documentation should be treated as the source of truth for configuration.
From the repository root:
dotnet build src/azure-computeschedule-dotnet-samples.slnFrom src:
dotnet buildUse the project file path for whichever sample you want to run:
dotnet run --project src/ExecuteCreate/ExecuteCreate.csproj
dotnet run --project src/ExecuteCreateFlex/ExecuteCreateFlex.csproj -- --api-demo --resource-count 5
dotnet run --project src/ExecuteStart/ExecuteStart.csproj
dotnet run --project src/ExecuteDeallocate/ExecuteDeallocate.csproj
dotnet run --project src/ExecuteDelete/ExecuteDelete.csproj
dotnet run --project src/ExecuteHibernate/ExecuteHibernate.csproj
dotnet run --project src/OperationFallback/OperationFallback.csproj
dotnet run --project src/AllScenarios/AllScenarios.csprojdotnet run --project ./ExecuteCreate/ExecuteCreate.csproj
dotnet run --project ./ExecuteCreateFlex/ExecuteCreateFlex.csproj -- --api-demo --resource-count 5
dotnet run --project ./ExecuteStart/ExecuteStart.csproj
dotnet run --project ./ExecuteDeallocate/ExecuteDeallocate.csproj
dotnet run --project ./ExecuteDelete/ExecuteDelete.csproj
dotnet run --project ./ExecuteHibernate/ExecuteHibernate.csproj
dotnet run --project ./OperationFallback/OperationFallback.csproj
dotnet run --project ./AllScenarios/AllScenarios.csprojIn any sample folder under src/<ProjectName>, you can usually run:
dotnet runSome projects support additional command-line arguments. For example, ExecuteCreateFlex can be run with:
dotnet run -- --api-demo --resource-count 5
dotnet run -- --batch-demo --resource-count 200For detailed setup, configuration, and usage instructions, check the documentation and source files in the folder for the sample you want to run.
src/
├── Common/
├── ExecuteCreate/
├── ExecuteCreateFlex/
├── ExecuteStart/
├── ExecuteDeallocate/
├── ExecuteDelete/
├── ExecuteHibernate/
├── OperationFallback/
├── AllScenarios/
├── NuGet.config
└── azure-computeschedule-dotnet-samples.sln
- src/ExecuteCreateFlex/README.md: setup and run instructions for the Flex sample
- src/ExecuteCreateFlex/rest-api-documentation.md: Flex create request and response reference
- src/OperationFallback/README.md: retry policy and
onFailureActionfallback scenarios
All sample projects reference src/Common, which contains the shared helper layer used across the repository:
ComputescheduleOperations.cs: common create, start, deallocate, delete, and hibernate operation flowsHelperMethods.cs: resource helpers, request builders, VNet creation, data disk creation, and operation pollingConsoleProgressRenderer.cs: single-line progress updates for longer-running flowsSetHeaderPolicy.cs: example of adding a custom ARM pipeline header policy