Manage App Service, SQL Database, and more - Azure Management Libraries for .NET

Gepost op 25 januari, 2017

Principal Program Manager, Azure Developer Experience

One C# statement to create a Web App. One statement to create a SQL Server and another statement to create a SQL Database. One statement to create an Application Gateway, etc.

Beta 4 of the Azure Management Libraries for .NET is now available. Beta 4 adds support for the following Azure services and features:

App Service (Web Apps)

SQL Database

✓  Application Gateway

✓ Traffic Manager

✓ DNS

✓ CDN

✓ Redis Cache

   

https://github.com/Azure/azure-sdk-for-net/tree/Fluent

You can download Beta 4 from:

 

Last year, we announced a preview of the new, simplified Azure management libraries for .NET. Our goal is to improve the developer experience by providing a higher-level, object-oriented API, optimized for readability and writability. These libraries are built on the lower-level, request-response style auto generated clients and can run side-by-side with auto generated clients. Thank you for trying the libraries and providing us with plenty of useful feedback.

Create a Web App

You can create a Web app instance by using a define() … create() method chain.

var webApp = azure.WebApps()
    .Define(appName)
    .WithNewResourceGroup(rgName)
    .WithNewAppServicePlan(planName)
    .WithRegion(Region.US_WEST)
    .WithPricingTier(AppServicePricingTier.STANDARD_S1)
    .Create();

Create a SQL Database

You can create a SQL server instance by using another define() … create() method chain.

var sqlServer = azure.SqlServers.Define(sqlServerName)
    .WithRegion(Region.US_EAST)
    .WithNewResourceGroup(rgName)
    .WithAdministratorLogin(administratorLogin)
    .WithAdministratorPassword(administratorPassword)
    .WithNewFirewallRule(firewallRuleIpAddress)
    .WithNewFirewallRule(firewallRuleStartIpAddress, firewallRuleEndIpAddress)
    .Create();

Then, you can create a SQL database instance by using another define() … create() method chain.

var database = sqlServer.Databases.Define(databaseName)
    .Create();

Create an Application Gateway

You can create an application gateway instance by using another define() … create() method chain.

var applicationGateway = azure.ApplicationGateways().Define("myFirstAppGateway")
    .WithRegion(Region.US_EAST)
    .WithExistingResourceGroup(resourceGroup)
    // Request routing rule for HTTP from public 80 to public 8080
    .DefineRequestRoutingRule("HTTP-80-to-8080")
        .FromPublicFrontend()
        .FromFrontendHttpPort(80)
        .ToBackendHttpPort(8080)
        .ToBackendIpAddress("11.1.1.1")
        .ToBackendIpAddress("11.1.1.2")
        .ToBackendIpAddress("11.1.1.3")
        .ToBackendIpAddress("11.1.1.4")
        .Attach()
    .WithExistingPublicIpAddress(publicIpAddress)
    .Create();

Sample code

You can find plenty of sample code that illustrates management scenarios in Azure Virtual Machines, Virtual Machine Scale Sets, Storage, Networking, Resource Manager, SQL Database, App Service (Web Apps), Key Vault, Redis, CDN and Batch.

Service Management Scenario
Virtual Machines

Virtual Machines - parallel execution

Virtual Machine Scale Sets
Storage
Networking
Networking - DNS
Traffic Manager
Application Gateway
SQL Database
Redis Cache
App Service - Web Apps
Resource Groups
Key Vault
CDN
Batch

Give it a try

You can run the samples above or go straight to our GitHub repo. Give it a try and let us know what do you think (via e-mail or comments below), particularly -

  • Usability and effectiveness of the new management libraries for .NET.
  • What Azure services you would like to see supported soon?
  • What additional scenarios should be illustrated as sample code?

Over the next few weeks, we will be adding support for more Azure services and applying finishing touches to the API.