page_type | languages | products | description | |||
---|---|---|---|---|---|---|
sample |
|
|
This is a simple .NET Core sample that uses the Azure .NET SDK to programmatically create EA subscriptions with a service principal. |
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
-
Get the .NET Core SDK.
-
Create an Azure service principal either through Azure CLI, PowerShell or the portal.
-
As an EA Account Owner, follow instructions to give the service principal access to your enrollment account.
-
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
-
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" }
-
Run the sample.
dotnet run