Microsoft Azure - Week6 Tuesday - Kookmin University 1
Objectives and what to study Window Azure Cloud Service Concepts Window Azure Cloud Service Development Deploy offline Create an Azure storage account Deploy on Azure cloud 2
Objectives Understand basic concepts of Window Azure Cloud Service What to study How to setup the environment to develop Window Azure Cloud Service application Develop a simple Window Azure Cloud Service applicat ion 3
WINDOW AZURE CLOUD SERVICES DEVELOPMENT 4
Reference from Microsoft Azure Website http://azure.microsoft.com/ http://www.windowsazure.com/ 5
Reference from Microsoft Azure Website http://azure.microsoft.com/en-us/documentation/ 6
Reference from Microsoft Azure Website Click on Cloud Services tab 7
Microsoft Azure provides sample code and explanation to develop app lications applying Azure services Link: https://code.msdn.microsoft.com/windowsazure/ http://azure.microsoft.com/en-us/develop/net/#cloud-services 8
Cloud Services explanation Compute Create a multi-tier.net application with an ASP.NET Build a.net multi-tier app with Service Bus Queues Create a multi-tier app using Storage Tables, Queues, and Blobs Configure SSL for a cloud service Configure a custom domain name for a cloud service Cloud service roles Deployment & source control Manage cloud service deployments to staging and production Publishing Cloud Services from Visual Studio Continuous delivery to Azure using Visual Studio online and Git Continuous delivery to Azure using Visual Studio Online Continuous delivery for Cloud Services with Team Foundation Server 9
Cloud Services samples Data Azure data management and analytics services Blob Storage Table Storage Queue Storage SQL Database Managing SQL Database using SSMS Develop C# Hadoop streaming programs for HDInsight 10
Cloud Services samples App services Azure Active Directory Service Bus Queues Service Bus Topics Event Hubs Service Bus Relay Service Bus AMQP Upload, encode, and stream media with Media Services Scheduler Send email using SendGrid Use Twilio for phone calls and SMS Use Blitline for image processing 11
Cloud Services samples App services Cloud ready Building real-world cloud applications Cloud design patterns Managed Cache Redis Cache In-role cache Azure Content Delivery Network (CDN) Design of large-scale services on Cloud Services 12
Cloud Services and ASP.NET This tutorial shows how to create a multi-tier.net application with an ASP.NET MVC front-end, and deploy it to an Azure cloud service. Use Azure SQL Database Azure Blob service Azure Queue service The Contoso Ads application Description Code: Start An advertising bulletin board Users create ads by entering texts and uploading images. http://code.msdn.microsoft.com/simple-azure-cloud-service-e01df2e4 Uncompress code Open project 13
Cloud Services and ASP.NET Error Packages Error Reason: not yet added Reference packages to the namespaces Solution: Download reference packages using NuGet 14
Cloud Services and ASP.NET Error Right click on solution of the project Click Restore Project will automatically install required packages Click Close button 15
Deploy without Cloud Set ContosoAdsCloudService as the st artup project Ctrl + F5 to start application Visual Studio automatically invokes the Azure compute emulator and Azurestora ge emulator. The compute emulator uses your comput er's resources to simulate the web role a nd worker role environments. The storage emulator uses a SQL Server Express LocalDB database to simulate Az ure cloud storage 16
Deploy without Cloud Create an Ad Enter data and select a.jpg image to u pload 17
Deploy to Azure Create an Azure cloud service Create an Azure SQL database Content Create an Azure storage account Configure to use Azure SQL database Configure to use Azure storage account Deploy the project 18
Deploy to Azure Go to http://manage.windowsazure.com/ Create Azure Cloud service Sign in 19
Deploy to Azure Create Azure Cloud service Click New -> Compute -> Cloud Service -> Quick Create In URL box: create a unique URL prefix Choose region Click Create Cloud Service 20
Deploy to Azure Server informs cloud service was created 21
Create an Azure SQL database Click New -> Data Services -> SQL Database -> Quick Create In Database Name box: use again the previous URL In Server drop-down list, choose New SQL Database server Choose the same region with the previous selection 22
Create an Azure SQL database Create new Login Name and Password Click on Create SQL Database 23
Create an Azure SQL database A SQL database is created in Azure Management Portal 24
Create an Azure SQL database Click on the name of the created database Click on Dashboard tab 25
Create an Azure SQL database Click on Manage allowed IP addresses Under Allowed Services, click Yes Click Save 26
Click on the name of the new database Click Manage tab -> Yes -> Yes 27
Click Manage tab again Log in with the created Username and Password 28
Create an Azure storage account Click New -> Data Services -> Storage -> Quick Create Enter an URL Location: East Asia In REPLICATION, choose Locally redundant Click Create storage account 29
Configure the solution To use Azure SQL database In ContosoAdsWeb project open Web.Release.config 30
Configure the solution To use Azure SQL database Replace comment block By the following block <connectionstrings> <add name="contosoadscontext" connectionstring="{connectionstring}" providername="system.data.sqlclient" xdt:transform="setattributes" xdt:locator="match(name)"/> </connectionstrings> 31
Configure the solution To use Azure SQL database In Azure Management Portal, click SQL Database Click Dashboard -> click Show connection strings 32
Configure the solution To use Azure SQL database The portal displays connection strings 33
Configure the solution To use Azure SQL database In the Web.Release.config, delete {connectionstring} and paste the ADO.NE connection string Replace {your_password_here} with your password for the new SQL database Save file Copy the connection string for use in the next steps 34
Configure the solution To use Azure SQL database Right click ContosoAdsWorker -> Click Properties 35
Configure the solution To use Azure SQL database Click Settings tab Change Service Configuration to Cloud Select ContosoAdsDbConnectionString, and past the connection string Save 36
Configure the solution To use Azure storage account Connection strings for both the web role project and the worker role project are stored in environment settings in the cloud service project. For each project, separate settings are used when the application runs locally or runs in the cloud. Update the cloud environment setting for both web and worker role projects. 37
Configure the solution To use Azure storage account Right-click on ContosoAdsWeb project -> Properties 38
Configure the solution To use Azure storage account Click Settings tab In Service Configuration, choose Cloud 39
Configure the solution To use Azure storage account Open the Create Storage Account Connection String dialog box By click on the corresponding button of StorageConnectionString 40
Configure the solution To use Azure storage account In the Create Storage Account Connection String dialog box choose the created storage account -> OK 41
Configure the solution To use Azure storage account set the Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString c onnection string for logging 42
Configure the solution To use Azure storage account choose the created storage account -> OK Save changes 43
Configure the solution To use Azure storage account Setting the ContosoAdsWorker project Right click on ContosoAdsWorker project -> Properties 44
Configure the solution To use Azure storage account On Service Configuration choose Cloud 45
Configure the solution To use Azure storage account Set StorageConnectionString 46
Configure the solution To use Azure storage account Set Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString 47
Configure the solution To use Azure storage account After configuring, the role environment settings are stored in the follo wing files in the ContosoAdsCloudService project ServiceDefinition.csdef - Defines the setting names. ServiceConfiguration.Cloud.cscfg - Provides values for when the app runs in the cloud. ServiceConfiguration.Local.cscfg - Provides values for when the app runs locally. 48
Deploy the project to Azure Right click on the ContosoAdsCloudService project -> Publish 49
Deploy the project to Azure Click Next to sign in 50
Deploy the project to Azure In Settings, click Next 51
Deploy the project to Azure In Summary, click Publish 52
Deploy the project to Azure The Azure Activity Log window opens in Visual Studio. Click the right arrow icon to expand the deployment click the Website URL to launch the application 53
Deploy the project to Azure Result of created page Click on Create an Ad to add Ads 54
Deploy the project to Azure Similarly, create an Ad Enter data and select a.jpg image to u pload 55
Deploy the project to Azure Edit ads 56
Deploy the project to Azure Result Access portal -> Storage -> Click on the created storage Blob to store images 57