In a previous post, we announced the releases of Visual Studio 2013 Update 2 RC and the Azure SDK 2.3 for .NET. In this post, we deep dive into these features for Azure development: Visual Studio 2013 Update 2 RC [download
- Dev/Test: Create Dev/Test environments (Azure Web Sites or VMs) for Web apps and generate automated PowerShell deployment scripts
- JSON Editor: New editor with IntelliSense support when editing Resource Manager templates
- Mobile Services: .NET support including remote debugging
- Notification Hubs: Send test notifications
Azure SDK 2.3 for .NET [download
] With the additional install of the Azure SDK 2.3 you also can take advantage of the following features:
- Virtual Machines: Remote debug native or managed code and create virtual machines from Server Explorer
- Web Sites: View and edit remote files and logs and easily publish Web apps using the improved Publish Web experience
- Cloud Services: General availability of Emulator Express with Run as Normal User support & Remote debugging for native code
- Storage: Updated Storage Emulator & Storage Client 3.0 now included in new projects
- PowerShell, X-Plat CLI and .NET Automation (separate downloads from Azure SDK 2.3): Support for using Resource Manager, and lots of new commands for automating Web Sites, Cloud Services, VMs and more
Dev/Test: Using Web Sites and VMs for Development and Testing of Web Applications
You can now easily create Azure Web Sites and Virtual Machines when creating new ASP.NET applications in Visual Studio to serve as target development and test environments. Additionally, when creating these resources, PowerShell scripts and a JSON configuration file will be added to your solution that will enable provisioning of additional instances of the resources and deploying your application to Azure. These scripts can be edited from Visual Studio, run on the developer’s desktop, used from a TFS build definition or in other release management tools that consume PowerShell. You can see this new functionality on the ASP.NET New Project dialog below:
If you choose Web Site, you can create a Web Site, as well as a linked Database:
If you choose Virtual Machine, you can create a VM using an MSDN image (available for MSDN subscribers only), Platform images like Windows Server 2012, or your own custom image available in your subscription. You also have the option to automatically configure the virtual machine for web development. Instead of needing to remote desktop into the virtual machine, you can now automatically configure IIS, ASP.NET, debugging, tracing, and enabling Web Deploy to automate publishing. Whether your app is intended to run on premise or in Azure, Visual Studio can create and configure the VM you need for web development.
Once your application is deployed, you can attach the debugger just as you would for an on premise application. See Virtual Machines: Remote Debugging
below for more information. Leveraging PowerShell for Creating Dev/Test environments from Visual Studio Along with creating the resources, Visual Studio will provide PowerShell scripts and JSON configuration files for creating and deploying to a Web Site or VM.
You can also easily duplicate the configuration file provided by Visual Studio to create different instances of the web site or VM as well as leveraging the staging functionality of Azure Web Sites, as is shown in the following image. Editing these JSON files can be done in the new JSON editor release as part of Visual Studio 2013 Update 2 RC. See the JSON Editor
section below for more details.
You can also edit the PowerShell scripts within the Visual Studio IDE with the new support for PowerShell colorization.
Publish Web Updates With this release we have added some new features to the web publish dialog, including the ability to publish your web site directly to an Azure Virtual Machine. We have also simplified the user experience for publishing to Azure by putting Web Sites and Virtual Machines right on the first dialog:
To publish to an Azure Web Site or Virtual Machine you can click on the corresponding button. If you have a .publishsettings file to import, you can still use the Import button. For other scenarios you can manually specify the settings with the Custom
The release of Visual Studio 2013 Update 2 RC includes a JSON editor with support for JSON schema. When working with a JSON file, Visual Studio will automatically download the schema file from the location specified by the $schema
keyword. This way, you get up-to-date IntelliSense for your JSON file without having to update your project or Visual Studio. Since Azure Resource Manager
templates are JSON files that include the $schema
keyword, Visual Studio will automatically download the schema (as shown in the dropdown at the top of the editor) and give you IntelliSense when editing these files. In this example, you can see IntelliSense for the properties on an Azure SQL Database server:
Mobile Services: .NET Support and Remote Debugging
Visual Studio 2013 Update 2 RC also provides full support for creating your backend Mobile Service logic using .NET and the ASP.NET Web API framework. It’s easy to get started using .NET Mobile Services. Simply go to the New Project
) and select the ASP .NET Web Application
project template under the Web
node. Then, choose Azure Mobile Service
in the New ASP.NET Project dialog.
You will see a Mobile Services .NET project - this is a customized ASP.NET Web API project with additional Mobile Service NuGet packages and sample controllers included. Running the Mobile Service Locally Just like any other Web project, you can run your .NET Mobile Service project locally. Open the sample TodoItemController.cs in the project. The controller shows how you can use the built-in TableController<T> .NET class we provide with Mobile Services. Set a breakpoint inside the GetAllTodoItems() method and hit F5 in Visual Studio to run the Mobile Service locally. Mobile Services includes a help page to view and test your APIs. On the help page, click on the try it out
link and then click the GET tables/TodoItem
link. Then click try this out
on the GET tables/TodoItem page.
As you might expect, you will hit the breakpoint you set earlier.
Add Scaffolds You can add Web API, OData, or Mobile Service scaffolds through the Add Scaffold
dialog (right click on your project and choose Add
-> New Scaffolded Item
…). Publish your Mobile Services project to Azure Once you are done developing your Mobile Service, you can publish it to Azure. Right click on your project and choose the Publish
command. Using the publish wizard, you can publish to a new or existing Mobile Service. Remote debugging Just like Cloud Services, Virtual Machines and Web Sites, you can remote debug your Mobile Service live in Azure. To enable remote debugging for a Mobile Service, publish your Mobile Service again and set the Configuration
in the Publish wizard. Once your Mobile Service is published and running in the cloud, set a breakpoint in local source code, then use Server Explorer to select the Mobile Service instance deployed, right click and choose Attach Debugger
. Once the debugger attaches to the mobile service, you can use the robust debugging capabilities in Visual Studio to debug your app running in the cloud.
Notification Hubs: Send Test Notifications
In a previous Mobile Services runtime release, we enabled Notification Hubs in mainstream mobile development by creating a new Notification Hub and integrating it with each Mobile Service. With this release we’ve added a helpful troubleshooting tool that enables you to send test messages in Visual Studio. To send a test message open Server Explorer and select a notification hub under the Notifications Hubs
node, right click, and choose Send Test Notifications
In the notification hub window, you can send a message to ten random registrations, either to a particular tag or all (broadcast). You can select from a variety of templates - Windows Store, Windows Phone, Android, iOS, or even a cross platform message using the Custom Template. After you hit Send
, you’ll receive the message result instantly to help you diagnose if your message was successfully sent or not.
Virtual Machines: Creating Virtual Machines from Server Explorer
You can also create Virtual Machines directly from Server Explorer. Select the Create Virtual Machine
option from the context menu on the Virtual Machines node:
The Create New Virtual Machine wizard will guide you through a more detailed set of steps for creating a Virtual Machine. On the first page of the wizard you can choose the subscription to be used when the VM is created. The subscription dropdown will list all subscriptions you have access to with the current signed in credentials. Select <Manage…>
from the subscription dropdown if you want to sign in with a different set of credentials.
On the next page of the wizard you can select the image that will be used to create the VM. Use the Image Type
dropdown to choose from platform images, MSDN images or your own set of custom images. Details about the selected image are shown on the right.
After you select the image to use, there are three more pages of wizard:
- Machine Settings - Supply basic VM settings such as the name, size, and the administrator’s username and password.
- Cloud Service - Choose how the VM is exposed to the internet. If you already have cloud services in your subscription, you can choose to add this virtual machine to an existing cloud service, allowing you to load balance traffic from a single cloud service to multiple VMs. If you choose an existing cloud service, the virtual machine will be created in the same network as other virtual machines in that cloud service, in which case the Virtual Network and Subnet fields are disabled. You can also create a new cloud service if you would prefer. Similarly with the storage account, you can choose an existing storage account or create a new one. The storage account is used to store the VHD associated with the VM and it must be in the same region or affinity group as the VM. You can optionally choose to create the virtual machine in a specific availability set to avoid a single point of failure.
- Endpoints – Specify the endpoints the virtual machine will require. Remote Desktop and PowerShell endpoints are added by default so you can connect to the VM and run remote PowerShell commands. You can change the ports for these endpoints if you prefer to use a non-standard ports or remove them if you want. You can also add additional endpoints for any other services you may have running on the VM. To do so, choose the type of service from the Port Name list and click the Add button. Once the endpoint is added, you can modify the name, ports or protocol (Name and Port must be unique).
Once you are finished configuring the endpoints, click Create
to create the virtual machine. You will see progress in the activity window and once the VM is created, you’ll see the new VM in Server Explorer.
Virtual Machines: Remote Debugging
Also new in the 2.3 SDK is the ability to remotely debug virtual machines. You can enable debugging on a specific instance of a virtual machine from the context menu in Server Explorer.
You will see progress in the Activity Window as the Remote Debugging extension is enabled on the VM - no further configuration is required to enable remote debugging.
Once the debugging extension is enabled on the VM, you can attach the debugger or disable the debugging extension from the Server Explorer context menu.
When you choose the Attach Debugger
… menu item, the Attach to Process dialog will be displayed where you can choose the process on the Virtual Machine you want to debug. You can also choose what type of code (managed, native, or both) you want to debug by clicking the Select
With remote debugging enabled you will notice additional endpoints on the VM that are used by Visual Studio to interact with the remote debugging agent.
Web Sites: Remote View and Edit
In previous releases we added the support to view and manage Azure Web Sites from the Server Explorer. With this release, you can now remotely view your web site files and log files from Server Explorer. You can also save changes back to your site without the need to Publish. This is handy for temporary changes you want to make to your site (such as updating Web.config with customErrors mode=”off”) without changing your local project. In Server Explorer when you expand each web site you will see a node for Files and Log Files. See the image below.
Once you double click on a file, it will be downloaded and opened in Visual Studio. When you are ready to save your changes back to your Azure Web Site just click on the Save
button. You will see the confirmation dialog shown in the following image.
You can check the Don’t ask again
checkbox to prevent the confirmation dialog. You can also easily view log files, by double clicking on the file. If you make any edits to the files they will be saved locally. You cannot remotely edit log files from Visual Studio.
Cloud Services: Local Debugging with Emulator Express
With the release of SDK 2.3 we are announcing general availability of Emulator Express, and it is now the default compute emulator for new cloud service projects. Emulator Express allows you to run your cloud service projects locally as a normal user – that is, you can create and deploy cloud services without having to run Visual Studio as an administrator. This lightweight emulator, released as a preview in SDK 2.1, uses fewer resources than the full emulator and supports multi-role, single-instance scenarios.
Cloud Services: Remote Debugging
We are also announcing general availability of remote debugging for Cloud Services. With this release we also added more functionality to the debugging feature such as the capability to attach to any arbitrary process on your role or instance and the support for native and interoperability (managed and native) debugging. Remote debugging for Cloud Services is still enabled in the publish dialog as part of your publish process. Once your Cloud Service is published you just need to set a break point in your code from where you want to start debugging and select Attach Debugger
from Server Explorer. You can select Attach Debugger from either the role level or the instance level.
This will bring up the new Attach to Process dialog. Just like in debugging virtual machines the Attach to Process dialog shows all processes running on the instance. Select the process you want to attach the debugger to - in this case it is a web application so choose w3wp.exe
. You can also select the type of code you want to debug - in this example we want to enable interoperability debugging so we enable Managed (v4.5, v4.0) and Native.
Once the breakpoint is hit we can start using the debugger and all of its common functionalities such stepping through code and the Autos window.
If your managed code calls a function in native code which is referenced in your project you’ll be able to step from managed code into native code and continue debugging the native code as shown below.
Storage: Updated Emulator & Storage Client 3.0 Now Included in New Projects
The Storage Client Library for .NET version 3.0, previously released only on NuGet, is included in Azure SDK 2.3. This library adds support for the JSON protocol when using Tables, as well as compatibility with the new features released in November 2013, including Read Access Geo-Redundant Storage (RA-GRS). The storage emulator also now supports the November 2013 REST features, such as JSON and CORS. For more information, see Azure Storage Client Library 3
We also recently shipped Azure PowerShell 0.8.0 (which is a separate download
). Azure PowerShell ships frequently, and we’ve have had many releases since SDK 2.2. You can find out the full change log here
. Here are some of the improvements since 2.2 and available in the latest Azure PowerShell download:
- Azure Resource Manager support
- ExpressRoute support
- HDInsight support
- Scheduler support
- Virtual Machines: New extension cmdlets
- Cloud Services: New extension cmdlets
- Web Sites
- Staged Publishing support
- Web Jobs support
- New metrics and logging cmdlets
- New SAS token cmdlets
- New Reserved IP cmdlets
- New Static IP cmdlets
- Azure Pack VM support
PowerShell: Resource Manager Support
The recent PowerShell 0.8.0 release, as well as the X-Plat CLI
and .NET client libraries
, all include support for the new Resource Manager
. The PowerShell support is explained below. To use Resource Manager in PowerShell, open a PowerShell console and run
This will configure Azure PowerShell to use Resource Manager. If you want to switch back to use the Service Management API, run Switch-AzureMode AzureServiceManagement
. After that, you can use the following cmdlet to discover all the Resource Manager cmdlets we have.
Create a resource group from a local JSON template file To create a resource group using a template, you can use the following cmdlet
PS C:\> New-AzureResourceGroup
-Name testrg -Location "West US" -TemplateFile .\WebSiteAndSQLDatabase.json -StorageAccountName teststorage -siteName testsite
-hostingPlanName testplan -siteLocation "West US" -sku Free -workerSize 0 -serverName testsql serverLocation "West US"
-databaseName db -collation SQL_Latin1_General_CP1_CI_AS -administratorLogin scottgu -Verbose
cmdlet New-AzureResourceGroup at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Status is displayed while the resource group is getting created:
VERBOSE: 3:31:36 PM - Create resource group 'testrg' in location 'West US'
VERBOSE: 3:32:03 PM - Uploading template 'Microsoft.WebSiteSQLDatabase.0.1.0-preview1.json' to https://teststorage.blob.core.test-cint.azure-test.net/deployment-templates/20140324_223203_WebSiteAndSQLDatabase.json?sv=2013-08-15&sr=b&sig=lchiNTgZZpVH/FDgbQderQYv+UL/dqpD5ZbB24d5A+M=&st=2014-03-24T22:27:03Z&se=2014-03-25T22:32:03Z&sp=r.
VERBOSE: 3:32:04 PM - Template is valid.
VERBOSE: 3:32:05 PM - Create template deployment WebSiteAndSQLDatabase' using template https://teststorage.blob.core.test-cint.azure-test.net/deployment-templates/20140324_223203_WebSiteAndSQLDatabase.json?sv=2013-08-15&sr=b&sig=lchiNTgZZpVH/FDgbQderQYv+UL/dqpD5ZbB24d5A+M=&st=2014-03-24T22:27:03Z&se=2014-03-25T22:32:03Z&sp=r.
VERBOSE: 3:32:24 PM - Resource Microsoft.Sql/servers 'testsql' provisioning status in location 'westus' is Succeeded
VERBOSE: 3:32:24 PM - Resource Microsoft.Web/serverFarms 'testplan' provisioning status in location 'westus' is Succeeded
VERBOSE: 3:32:30 PM - Resource Microsoft.Sql/servers/databases 'testsql/db' provisioning status in location 'westus' is Succeeded
VERBOSE: 3:32:30 PM - Resource Microsoft.Sql/servers/firewallrules 'testsql/AllowAllWindowsAzureIps' provisioning status in location 'westus' is Succeeded
VERBOSE: 3:32:37 PM - Resource Microsoft.Web/Sites 'testsite' provisioning status in location 'westus' is Succeeded
VERBOSE: 3:32:45 PM - Resource Microsoft.Web/Sites/config 'testsite/web' provisioning status in location 'westus' is Succeeded
ResourceGroupName : testrg
Location : West US
ProvisioningState : Succeeded
Name Type Location
========== ========================= ========
testsql Microsoft.Sql/servers westus
testsql/db Microsoft.Sql/servers/databases westus
testplan Microsoft.Web/serverFarms westus
testsite Microsoft.Web/sites westus
Notice that parameters like “siteName” are added to the cmdlet dynamically based on the template file you specify. The cmdlet is smart enough to parse the template and figure out the parameter names, types, and allowed values. As a result, you get all the PowerShell goodness, like tab-completion and syntax checking. Moreover, we will treat any parameter in the template with type “securestring” as PowerShell SecureString so that you can specify the credentials securely. Instead of dynamic parameters, you can alternatively use TemplateParameterObject
to specify a parameter hash table or TemplateParameterFile
to specify a parameter file. Create a resource group from the gallery In additional to using a local template file, we also make it easy to use a template from the gallery directly. You can use the following cmdlets to search/download for the proper gallery template you want to use or customize.
# List all the gallery templates published by Microsoft
Get-AzureResourceGroupGalleryTemplate -Publisher Microsoft
# Get detail information of a particular template
Get-AzureResourceGroupGalleryTemplate -Identity Microsoft.WebSiteSQLDatabase.0.1.0-preview1
# Download a particular template
Save-AzureResourceGroupGalleryTemplate -Identity Microsoft.WebSiteSQLDatabase.0.1.0-preview1
Alternatively, you can use the GalleryTemplateIdentity
parameter of New-AzureResourceGroup
cmdlet to create a resource group directly using the gallery template. And of course, dynamic parameters also work in this case. After you’ve created the resource groups, you can use Get-AzureResourceGroup
to view the resource group information. You can use Get-AzureResourceGroupDeployment
to learn more about the template deployment history. You can even is Get-AzureResourceGroupLog
to get the detail logs of all the operations, which is really useful for diagnostics.
Summary Visual Studio 2013 Release 2 RC
and the Azure SDK 2.3 make it easier than ever to get started developing rich cloud applications. Along with the Azure Developer Center’s growing set of .NET developer resources
to guide your development efforts, the Azure SDK 2.3 release should make your development experience more enjoyable and efficient. If you don’t already have an Azure account, you can sign-up for a free trial
and start using all of the above features today. Then visit the Azure Developer Center
to learn more about how to build apps with it.