Programmatically create Azure EA Subscriptions with .NET Core

This is a simple .NET Core sample that uses the Azure .NET SDK to programmatically create EA subscriptions with a service principal.

Run this sample

  1. Get the .NET Core SDK.

  2. Create an Azure service principal either through Azure CLI, PowerShell or the portal.

  3. As an EA Account Owner, follow instructions to give the service principal access to your enrollment account.

  4. Clone the repository and install dependencies

    git clone https://github.com/Azure-Samples/create-azure-subscription-dotnet-core.git
    cd create-azure-subscription-dotnet-core
    dotnet restore
    
  5. Create an appsettings.json using your tenant ID, application client ID, and client secret from the service principal that you created. Example:

    {
        "tenantId": "yourtenant.onmicrosoft.com",
        "appId": "app ID of the service principal",
        "secret": "client secret of the service principal"
    }
    
  6. Run the sample.

    dotnet run
    

Resources