Introduction to Configuring the azure website settings

The first step you will need to follow for an Azure website is to configure the Azure website settings. The website settings provide you with various options such as configuring language versions, linking strings, app settings and more. The table below highlights some of the common settings along with their possible values.

SETTINGVALUES
.NET Framework VersionV3.5, V4.5 (default)
PHP VersionOFF, 5.3, 5.4 (default), 5.5
Java VersionOFF (default), 1.7.0_51
Python VersionOFF (default), 2.7.3, 3.4.0
Platform32-bit (default), 64-bit
Web SocketsOFF (default), ON
Always OnOFF (default), ON
Remote DebuggingOFF (default), ON
Remote Visual Studio Version – Only applicable if Remote Debugging is ON.2012, 2013

TABLE 1 General settings for Azure Websites

Connection strings and application settings

Similar to any other website, an Azure website has a database for storing data. These websites come with an exclusive way of organizing connection strings to the database by allowing you to offer a connection string setting as an important component of the website setting. When you store a connection string as a site setting, the app will retrieve the connection string at an operational time as a setting variable instead of storing it in a web configuration. This method is relatively safe as it prevents storing any sensitive data such as username and password in the  config files for the website. Azure websites are capable of supporting the following types of database connection strings:

  • SQL Database A connection string for an Azure SQL Database.
  • SQL Server A connection string for a SQL Server running on a physical machine or perhaps an Azure Virtual Machine.
  • MySQL A connection string for a MySQL Database.
  • Custom A connection string for other NoSQL storage options, such as an Azure Storage account.

Azure websites uses the similar approach for app settings on which a typical website depends. There can
be several application settings such as a website service, a URL, or a custom operational setting that the
application code recognizes. Website settings for connection strings and app settings are known as key/value
pairs. You can suggest any name for the key through which you are going to reference the app setting or
connection string. For instance, below is the sample of how a key/value pair can be defined for a
connection string to a SQL database.

Key = "ContosoDBConnStr"
Value="Server=tcp:contosodbsrv01.database.windows.net,1433;Database=contosoDatabase;[email protected];Password=your_password_here};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"

The value for a connection string is defined as a website setting which can be utlilized by operational
time by referencing the name of the variable for the setting. The title of the environmental variable
combines the constant string depending on the type of database connection string plus along with the
name of the key.The constant strings are as follows:

  • SQLAZURECONNSTR_
  • SQLCONNSTR_
  • MYSQLCONNSTR_
  • CUSTOMCONNSTR_

With the use of the above-mentioned example, the environment variable name for the ContosoDBConnStr connecting string can be SQLAZURECONNSTR_ContosoDBConnStr. Likewise, the value for an app setting is defined as a website setting which can be retrieved at the runtime by referencing the title of the environment variable for the setting. Another example is if an app setting key is defined as ContosoHRWebServiceURL, then the environment variable name for the setting is APPSETTING_ ContosoHRWebServiceURL.

It is recommended to store connection strings and application settings as website settings for an Azure website, though you are not bound to do so. Application developers have an option for storing these settings in app configuration files such as Web.config or Php.ini files.

An app setting or connection string is defined in both an application configuration file and as a website setting in the Azure website. The website setting value has precendence over the setting in the app configuration file.

Configuring site settings using the management portal

You will find a configuration segment containing the website settings icon in the website blade for the Azure website. You can click on this icon to open the website settings blade where you can make any configuration changes. Figure 1 illustrates the general settings section of the website settings blade.

Configuring the Azure website settings 1

FIGURE 1 General Settings in the Site Settings blade

Configuring site settings using Azure PowerShell

If you want to specify website settings using Azure PowerShell, you can use theSet-AzureWebsite cmdlet. For instance, this code shows enabling web sockets for a website.

$wsName = "contoso-web"
Set-AzureWebsite $wsName -WebSocketsEnabled $true

Moreover, if you want to define app settings using PowerShell, you are required to create a hash table to define the setting. Below is the example demonstrating the key/value pair for application.

 settings.$settings = New-Object Hashtable $settings["Contoso_HR_WebService_URL"] = "https://contoso-webservices/hr"
 Set-AzureWebsite $wsName -AppSettings $settings

This is an example defining a connection string using Azure PowerShell where a ConnectionStringInfo structure can be used to define the connection string

$connStrs = (@{Name="contosodb"; Type="SQLAzure"; ConnectionString="Server=tcp:.." }) 
Set-AzureWebsite -Name $wsName -ConnectionStrings $connStrs

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...