%3CLINGO-SUB%20id%3D%22lingo-sub-311907%22%20slang%3D%22en-US%22%3EMicrosoft%20Azure%20Tutorial%3A%20Build%20your%20first%20movie%20inventory%20web%20app%20with%20just%20a%20few%20lines%20of%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-311907%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Apr%2012%2C%202016%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20%3CEM%3E%20Editor%E2%80%99s%20Note%3A%20%3C%2FEM%3E%20%3C%2FSTRONG%3E%20%3CEM%3E%20The%20following%20is%20a%20guest%20post%20from%20Mustafa%20Mahmutovi%C4%87%2C%20a%20Microsoft%20Student%20Partner%20who%20attends%20the%20Faculty%20of%20Electrical%20Engineering%20at%20the%20University%20of%20Sarajevo%20where%20he%20is%20a%20Computer%20Science%20Major.%20%3C%2FEM%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20this%20tutorial%2C%20you%20will%20learn%20how%20the%20built-in%20features%20of%20Visual%20Studio%20Community%202015%20and%20the%20.NET%20framework%20do%20a%20lot%20of%20the%20work%20for%20you%20in%20when%20creating%20a%20web%20app.%20Using%20very%20little%20code%2C%20you%E2%80%99ll%20build%20a%20database%20of%20a%20movie%20collection.%20So%2C%20even%20if%20you%20are%20new%20to%20programming%2C%20you%20can%20use%20these%20tools%20and%20services%20to%20make%20something%20cool.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20ASP.NET%20MVC%20is%20a%20web%20app%20framework%20that%20gives%20you%20a%20powerful%20way%20to%20build%20dynamic%20web%20apps.%20You%E2%80%99ll%20use%20ASP.NET%20MVC%205%20and%20Entity%20Framework%206%2C%20which%20gets%20deployed%20on%20Azure%20App%20Service%20%E2%80%93%20Web%20App%20and%20Azure%20SQL%20Database.%20%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20will%20need%20%3CA%20href%3D%22https%3A%2F%2Fwww.dreamspark.com%2FProduct%2FProduct.aspx%3Fproductid%3D99%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Microsoft%20Azure%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D615448%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20Visual%20Studio%202015%20Community%20Edition%20%3C%2FA%3E%20and%20%3CA%20href%3D%22http%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3Flinkid%3D518003%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20Microsoft%20Azure%20SDK%20for%20.NET%20(VS%202015)%20-%202.8.2%20%3C%2FA%3E%20.%20In%20addition%2C%20you%20will%20need%20to%20register%20and%20verify%20yourself%20as%20a%20student%20if%20you%20haven't%20already%2C%20which%20you%20can%20do%20%3CA%20href%3D%22https%3A%2F%2Fwww.dreamspark.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20here%20%3C%2FA%3E%20.%20%3CBR%20%2F%3E%3CBR%20%2F%3ELet's%20get%20started!%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Using%20your%20Microsoft%20Account%2C%20sign%20into%20%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Microsoft%20Azure%20%3C%2FA%3E%20.%20As%20you%20can%20see%2C%20there%20are%20many%20options%20on%20the%20Azure%20portal.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65413iF30F8C6091BBFA43%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ELeave%20Azure%20open%20in%20your%20browser%2C%20we'll%20use%20it%20later.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1845232247%22%20id%3D%22toc-hId--1439429470%22%3EStep%20One%3A%20Develop%20an%20MVC%20Web%20App%3C%2FH2%3E%3CBR%20%2F%3E%20Now%20it's%20time%20to%20develop%20our%20MVC%20Web%20App%20on%20Azure%2C%20using%20EntityFramework%20with%20CRUD%20(create%2C%20read%2C%20update%20and%20delete).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20Open%20Visual%20Studio%20Community%202015%20and%20log%20in%20to%20your%20Azure%20account.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65414i9824AA3E98FD6800%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E2.%20Open%20cloud%20explorer%20to%20see%20all%20the%20projects%20or%20apps%20you%20have%20on%20your%20Azure%20account%3A%20View-%26gt%3BOther%20windows-%26gt%3BCloud%20Explorer%20or%20View-%26gt%3BCloud%20Explorer%20(the%20second%20option%20in%20my%20version).%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65415iC58889992434BDBB%22%20%2F%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E3.%20If%20you%20can%E2%80%99t%20find%20%E2%80%98Cloud%20Explorer%E2%80%99%20in%20%E2%80%98Other%20Windows%E2%80%99%2C%20check%20%E2%80%98View%E2%80%99%20in%20the%20list%20menu.%20When%20you%20have%20clicked%20%E2%80%98Cloud%20Explorer%E2%80%99%2C%20this%20is%20what%20you%E2%80%99ll%20see%20in%20Visual%20Studio.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--706924714%22%20id%3D%22toc-hId-1048083363%22%3EStep%20Two%3A%20Create%20a%20New%20ASP.NET%20Web%20Application%20Project%3C%2FH2%3E%3CBR%20%2F%3E%20Now%20let's%20create%20a%20new%20ASP.NET%20web%20application%20project.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20To%20name%20a%20project%2C%20go%20to%20File-%26gt%3BNew%20Project-%26gt%3BWeb-%26gt%3BASP.NET%20Web%20Application.%20(For%20the%20purposes%20of%20this%20tutorial%2C%20I%20have%20kept%20the%20default%20option).%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65416iCE5259F31EAB0BB2%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E2.%20When%20you%20click%20%E2%80%98OK%E2%80%99%2C%20a%20new%20window%20will%20pop%20up.%20First%2C%20choose%20MVC%2C%20then%20make%20sure%20that%20you%20are%20using%20Azure%20and%20that%20%E2%80%98Host%20in%20the%20cloud%E2%80%99%20is%20selected.%20Then%20click%20OK.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65417iC6FC79DE07805533%22%20%2F%3E%3C%2FP%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1035885621%22%20id%3D%22toc-hId--759371100%22%3EStep%20Three%3A%20Create%20an%20App%20Service%3C%2FH2%3E%3CBR%20%2F%3E%20The%20next%20step%20will%20help%20you%20create%20a%20new%20app%20service%20on%20Azure.%20When%20the%26nbsp%3B'%20%3CSTRONG%3E%20Configure%20Microsoft%20Azure%20Web%20App%20Settings'%20%3C%2FSTRONG%3E%20dialog%20appears%2C%20make%20sure%20that%20you%20are%20signed%20in%20to%20Azure.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65418i4CE2BF49758133F0%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E1.%20First%20you%20will%20have%20to%20give%20a%20unique%20Web%20App%20Name%20(I%20named%20mine%20AppName%20WebApplicationOOAD).%20If%20you%20want%20to%20specify%20a%20name%20for%20your%20web%20app%2C%20change%20the%20value%20in%20the%20%3CSTRONG%3E%20'Web%20App%20Name'%20%3C%2FSTRONG%3E%20The%20URL%20of%20the%20web%20app%20will%20be%20%7Bname%7D.azurewebsites.net%2C%20so%20the%20name%20has%20to%20be%20unique%20in%20the%20azurewebsites.net%20domain.%20The%20configuration%20wizard%20suggests%20a%20unique%20name%20by%20adding%20a%20number%20to%20the%20project%20name%20%22WebApplicationOOAD%2C%E2%80%9C%20which%20is%20fine%20for%20the%20purposes%20of%20this%20tutorial.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%202.%20In%20the%20'Subscription'%20box%2C%20you'll%20use%20your%20DreamSpark%20subscription.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%203.%20For%20'Resource%20Group'%2C%20type%20the%20name%20of%20your%20new%20resource%20group.%20You%20can%20use%20one%20resource%20group%20for%20multiple%20projects%20or%20you%20can%20create%20a%20new%20resource%20group%20for%20each%20project%20that%20will%20be%20on%20Azure.%20I%20have%20named%20mine%20mvcAppGroup.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%204.%20For%20'App%20Service%20Plan'%2C%20double-click%20on%20'new'%2C%20then%20choose%20the%20nearest%20region%20and%20click%20'OK'.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65419i434A42B101AC2BE5%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E5.%20When%20you%20are%20done%2C%20you%20should%20see%20something%20like%20this%20(except%20that%20you%20will%20have%20a%20DreamSpark%20subscription)%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65420i1131D37FAFB3B6C0%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%206.%20Click%20%E2%80%98create%E2%80%99.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Once%20your%20project%20is%20created%2C%20your%20first%20view%20will%20be%20the%20one%20shown%20below.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65421i3B00F36FC75E8F36%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E7.%20Now%20let%E2%80%99s%20test%20the%20default%20generated%20view%20on%20MVC%20Web%20App.%20Click%20on%20the%20start%20icon%20and%20select%20Microsoft%20Edge.%20Before%20that%2C%20you%20can%20see%20that%20ASP.NET%20already%20created%20Models%2C%20Views%20and%20Controllers%20for%20us.%20The%20browser%20will%20open%20your%20app%20and%20you%20will%20see%20this%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65422i9B1E41EFD419FDE1%22%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1516271340%22%20id%3D%22toc-hId-1728141733%22%3EStep%20Four%3A%20Add%20a%20New%20Class%3C%2FH2%3E%3CBR%20%2F%3E%20Now%20let%E2%80%99s%20go%20back%20to%20Visual%20Studio%20and%20add%20a%20new%20class%20to%20the%20project%20(this%20class%20represents%20a%20table%20and%20the%20properties%20represents%20the%20colums%20of%20that%20table).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20Open%20the%20folder%20named%20%E2%80%98Models%E2%80%99%2C%20right-click%20and%20Add-%26gt%3BNew%20Item-%26gt%3BClass.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%202.%20Give%20a%20name%20to%20that%20class%20(I%20called%20it%20'Movie').%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65423i2770B3FDF8310559%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E3.%20On%20the%20class%2C%20create%20(or%20copy%2Fpaste)%20the%20following%20code%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65424i697C3683ECCDDF8F%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%204.%20You%20will%20get%20an%20error%20message%20on%20DbContext.%20Simply%20right-click%20on%20the%20error%20to%20resolve%20and%20add%20a%20library%20to%20the%20class%3A%20Entity%20or%20shortcut%20CTRL%20%2B%20.%20(dot)%20enter%2C%20enter.%20You%20will%20end%20up%20with%20something%20like%20this%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65425i7C669EC82861154D%22%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-226538995%22%20id%3D%22toc-hId--79312730%22%3EStep%20Five%3A%20Add%20a%20Controller%20using%20Scaffold%3C%2FH2%3E%3CBR%20%2F%3E%20The%20next%20thing%20we%E2%80%99ll%20create%20is%20a%20Scaffold%20Item.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20Right%20click%20on%20Controllers-%26gt%3BAdd-%26gt%3BNew%20Scaffolded%20Item%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65426i16B6AA8BB443434A%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%202.%20Now%20choose%2C%20%E2%80%98MVC%205%20Controller%20with%20views%2C%20using%20Entity%20Framework%E2%80%99%20and%20click%20%E2%80%98Add%E2%80%99.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65427i642BA472DB634CC9%22%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2016%2F04%2FImage-15.png%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CBR%20%2F%3E%3C%2FA%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65428i61C95758304E533A%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E3.%20Enter%20your%20model%20name%20in%20the%20empty%20fields.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65429i13B44EED2B3CB55E%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E4.%20If%20an%20error%20pops%20up%20like%20the%20screenshot%20below%2C%20just%20rebuild%20a%20solution%20and%20try%20to%20add%20a%20Scaffolded%20item%20again.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65430i6CC2F6B814CD3868%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAfter%20the%20code%20generation%20process%20is%20complete%2C%20you%20will%20see%20a%20new%20controller%20and%20views%20in%20your%20project.%20The%20Controller%20was%20automatically%20created%20with%20CRUD%20operations.%20The%20Views%20were%20automatically%20created%20(open%20'Views'%20and%20you%20will%20see%20a%20subfolder%2C%20'Movies'%2C%20and%20then%20'Create%2C'%20'Delete%2C'%20'Details%2C'%20'Edit.')%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65431iAB55CAA653F9C0B7%22%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1969349330%22%20id%3D%22toc-hId--1886767193%22%3EStep%20Six%3A%20Add%20Movies%20to%20Web%20App%20Display%3C%2FH2%3E%3CBR%20%2F%3E%20Now%20we%20want%20to%20add%20a%20link%20to%20our%20main%20page%20to%20add%20or%20delete%20a%20movie.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20Select%20Views-%26gt%3BShared-%26gt%3B_Layout.cshtml%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65432iAADD593163D4E7AF%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%202.%20Find%20the%20code%20for%20the%20navgation%20bar%20under%20%3CDIV%20class%3D%22''navbar-collapse%22%20collapse%3D%22%22%3E.%20After%20that%20line%2C%20simply%20add%20the%20following%20code%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%40Html.ActionLink(%20displayed%2Cview%20Name%2Cfolder%20name)%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65433i4099CC44021DC7C3%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%203.%20Now%20that%20you%20have%20displayed%20movies%2C%20you%20will%20be%20taken%20to%20the%20Movies%20index%20page.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65434iD4E5163B0A0C3F6E%22%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--582807631%22%20id%3D%22toc-hId-600745640%22%3EStep%20Seven%3A%20Create%20a%20Server%20on%20Azure%3C%2FH2%3E%3CBR%20%2F%3E%20Now%20we%20are%20ready%20to%20create%20a%20server%20on%20Azure.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20Go%20to%20%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Azure%20%3C%2FA%3E%20.%20If%20you%20have%20closed%20that%20tab%20or%20browser%2C%20log%20in%20again.%20%3CSTRONG%3EImportant%3A%20Do%20not%20close%20Visual%20Studio!%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%202.%20Go%20to%20New-%26gt%3BData%2BStorage-%26gt%3BSQL%20Database.%20Fill%20in%20the%20empty%20fields.%203.%20Name%20your%20database%20and%20click%20on%20Server-%26gt%3BCreate%20a%20new%20server.%20Add%20server%20name%2C%20admin%2C%20password%20and%20your%20location%20(just%20like%20for%20App%20Service%20location).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%204.%20Click%20%E2%80%98OK%E2%80%99.%205.%20Remember%20your%20server%20name%2C%20admin%20login%20and%20password.%20In%20my%20example%2C%20it%20is%20ooadexample.database.windows.net.%20Select%20%E2%80%98Create%E2%80%99.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65437i367C2101DFCE4776%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20will%20see%20that%20Azure%20is%20creating%20the%20database.%20Wait%20for%20it%20to%20finish.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65438i2F15D25ED9ADF934%22%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1160002704%22%20id%3D%22toc-hId--1206708823%22%3EStep%20Eight%3A%20Create%20Connection%20Strings%3C%2FH2%3E%3CBR%20%2F%3E%201.%20Select%20your%20database.%20Under%20the%20label%20%E2%80%98Connection%20Strings%E2%80%99%2C%20click%20on%20%E2%80%98Show%20database%20connection%20strings.%E2%80%99%20Select%20the%20link%20in%20the%20ADO.NET%20box%20and%20copy%20it.%202.%20Go%20back%20to%20Visual%20Studio.%20Right%20click%20on%20%E2%80%98Project%E2%80%99%20and%20click%20%E2%80%98Publish.%E2%80%99%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65440i6A73FA23B8B816E2%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%203.%20This%20action%20launches%20the%20%E2%80%98Publish%20Web%E2%80%99%20window.%20Paste%20the%20previously%20copied%20connection%20string%20into%20the%20ApplicationDbContext%20and%20MoviesDbContext%20fields.%20Then%20click%20on%20the%20three%20dots%20(%E2%80%A6).%5D%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65441i18F8FDA09279D7E8%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%204.%20The%20fields%20should%20automatically%20populate%20the%20correct%20information%20in%20the%20Destination%20Connection%20String%20window%20shown%20below.%20If%20not%2C%20enter%20your%20server%20name%20(in%20my%20example%3A%20ooadexample.database.windows.net)%20and%20password.%20Check%20%E2%80%98Save%20my%20password.%E2%80%99%20Important%3A%20if%20password%20is%20not%20filled%2C%20enter%20your%20password%20and%20check%20%E2%80%9CSave%20my%20password%E2%80%9D.%205.%20Select%20%E2%80%98OK%E2%80%99.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1392154257%22%20id%3D%22toc-hId-1280804010%22%3EStep%20Nine%3A%20Test%20the%20Published%20App%3C%2FH2%3E%3CBR%20%2F%3E%20Your%20app%20will%20now%20open%20in%20your%20browser.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20Click%20on%20%E2%80%98Movies.%E2%80%99%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65443iBF0905B7385B2589%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%202.%20Test%20it%20by%20adding%20a%20title%2C%20release%20date%2C%20genre%20and%20price.%20Enter%20mm%2Fdd%2Fyyyy%20(American%20date%20time%20settings).%203.%20Creating%20a%20title%20here%20will%20also%20add%20it%20to%20your%20database%20on%20Azure.%20Close%20the%20tab%20and%20reopen%20it%20again%20to%20verify.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65445i6C0D1C2B4248CE03%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-350656078%22%20id%3D%22toc-hId--526650453%22%3EStep%20Ten%3A%20Verify%20Data%20in%20Azure%3C%2FH2%3E%3CBR%20%2F%3E%201.%20To%20verify%20that%20the%20movie%20data%20you%20entered%20in%20Step%20Nine%20appears%20in%20your%20Azure%20database%2C%20go%20to%20Visual%20Studio.%20Under%20%E2%80%98Cloud%20Explorer%E2%80%99%2C%20right-click%20on%20your%20database%20and%20click%20%E2%80%98Open%20in%20SQL%20Server%20Object%20Explorer%E2%80%99.%202.%20Now%20enter%20your%20server%20name%2C%20admin%20and%20password.%20Click%20%E2%80%98Connect%E2%80%99.%203.%20Once%20connected%2C%20you%20will%20see%20that%20the%20migration%20has%20indeed%20occurred.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F65448iCF79E322918EE8A9%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20you%20know%20how%20to%20upload%20an%20MVC%20web%20app%20to%20Azure%20using%20Entity%20framework%20and%20CRUD.%20I%20hope%20you've%20found%20it%20useful!%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Microsoft%20Imagine%2C%20anywhere%2C%20anytime%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EFollow%20us%20on%20%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2FMSFTImagine%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Twitter%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22https%3A%2F%2Fwww.facebook.com%2FMSFTImagine%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Facebook%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22https%3A%2F%2Fwww.instagram.com%2Fmsftimagine%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Instagram%20%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fuser%2Fimaginecupmicrosoft%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20YouTube%20%3C%2FA%3E%20.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fmicrosoft_student_developer_blog%2Ffeed%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20Subscribe%20to%20our%20blog%20%3C%2FA%3E%20to%20meet%20students%20just%20like%20you%20who%20are%20changing%20the%20world%20with%20their%20exciting%20new%20tech.%20Plus%2C%20stay%20on%20top%20of%20all%20the%20new%20products%20and%20offerings%20for%20students.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EGet%20inspiration%20delivered%20to%20your%20inbox%20via%20our%20monthly%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fimagine%2Fimagine-register%3FWT.mc_id%3D16027-Student-nl-reg-ima-blog-posts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20Microsoft%20Imagine%20Newsletter%20%3C%2FA%3E%20%2C%20featuring%20the%20latest%20tech%20tips%2C%20competition%20news%20and%20all%20kinds%20of%20online%20tutorials.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EBookmark%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fimagine%2Fimagine-home%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20Microsoft%20Imagine%20%3C%2FA%3E%20for%20all%20the%20student%20developer%20news%2C%20downloads%20to%20free%20student%20products%2C%20online%20tutorials%20and%20contests%20you%20could%20want.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-311907%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Apr%2012%2C%202016%20Editor%E2%80%99s%20Note%3A%20The%20following%20is%20a%20guest%20post%20from%20Mustafa%20Mahmutovi%C4%87%2C%20a%20Microsoft%20Student%20Partner%20who%20attends%20the%20Faculty%20of%20Electrical%20Engineering%20at%20the%20University%20of%20Sarajevo%20where%20he%20is%20a%20Computer%20Science%20Major.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-311907%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emicrosoft%20student%20partners%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Estudent%20developers%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
First published on MSDN on Apr 12, 2016
Editor’s Note: The following is a guest post from Mustafa Mahmutović, a Microsoft Student Partner who attends the Faculty of Electrical Engineering at the University of Sarajevo where he is a Computer Science Major.

In this tutorial, you will learn how the built-in features of Visual Studio Community 2015 and the .NET framework do a lot of the work for you in when creating a web app. Using very little code, you’ll build a database of a movie collection. So, even if you are new to programming, you can use these tools and services to make something cool.

ASP.NET MVC is a web app framework that gives you a powerful way to build dynamic web apps. You’ll use ASP.NET MVC 5 and Entity Framework 6, which gets deployed on Azure App Service – Web App and Azure SQL Database.

You will need Microsoft Azure , Visual Studio 2015 Community Edition and Microsoft Azure SDK for .NET (VS 2015) - 2.8.2 . In addition, you will need to register and verify yourself as a student if you haven't already, which you can do here .

Let's get started!

Using your Microsoft Account, sign into Microsoft Azure . As you can see, there are many options on the Azure portal.







Leave Azure open in your browser, we'll use it later.

Step One: Develop an MVC Web App


Now it's time to develop our MVC Web App on Azure, using EntityFramework with CRUD (create, read, update and delete).

1. Open Visual Studio Community 2015 and log in to your Azure account.







2. Open cloud explorer to see all the projects or apps you have on your Azure account: View->Other windows->Cloud Explorer or View->Cloud Explorer (the second option in my version).







3. If you can’t find ‘Cloud Explorer’ in ‘Other Windows’, check ‘View’ in the list menu. When you have clicked ‘Cloud Explorer’, this is what you’ll see in Visual Studio.

Step Two: Create a New ASP.NET Web Application Project


Now let's create a new ASP.NET web application project.

1. To name a project, go to File->New Project->Web->ASP.NET Web Application. (For the purposes of this tutorial, I have kept the default option).







2. When you click ‘OK’, a new window will pop up. First, choose MVC, then make sure that you are using Azure and that ‘Host in the cloud’ is selected. Then click OK.




Step Three: Create an App Service


The next step will help you create a new app service on Azure. When the ' Configure Microsoft Azure Web App Settings' dialog appears, make sure that you are signed in to Azure.





1. First you will have to give a unique Web App Name (I named mine AppName WebApplicationOOAD). If you want to specify a name for your web app, change the value in the 'Web App Name' The URL of the web app will be {name}.azurewebsites.net, so the name has to be unique in the azurewebsites.net domain. The configuration wizard suggests a unique name by adding a number to the project name "WebApplicationOOAD,“ which is fine for the purposes of this tutorial.

2. In the 'Subscription' box, you'll use your DreamSpark subscription.

3. For 'Resource Group', type the name of your new resource group. You can use one resource group for multiple projects or you can create a new resource group for each project that will be on Azure. I have named mine mvcAppGroup.

4. For 'App Service Plan', double-click on 'new', then choose the nearest region and click 'OK'.







5. When you are done, you should see something like this (except that you will have a DreamSpark subscription):







6. Click ‘create’.

Once your project is created, your first view will be the one shown below.







7. Now let’s test the default generated view on MVC Web App. Click on the start icon and select Microsoft Edge. Before that, you can see that ASP.NET already created Models, Views and Controllers for us. The browser will open your app and you will see this:




Step Four: Add a New Class


Now let’s go back to Visual Studio and add a new class to the project (this class represents a table and the properties represents the colums of that table).

1. Open the folder named ‘Models’, right-click and Add->New Item->Class.

2. Give a name to that class (I called it 'Movie').







3. On the class, create (or copy/paste) the following code:







4. You will get an error message on DbContext. Simply right-click on the error to resolve and add a library to the class: Entity or shortcut CTRL + . (dot) enter, enter. You will end up with something like this:




Step Five: Add a Controller using Scaffold


The next thing we’ll create is a Scaffold Item.

1. Right click on Controllers->Add->New Scaffolded Item







2. Now choose, ‘MVC 5 Controller with views, using Entity Framework’ and click ‘Add’.








3. Enter your model name in the empty fields.







4. If an error pops up like the screenshot below, just rebuild a solution and try to add a Scaffolded item again.







After the code generation process is complete, you will see a new controller and views in your project. The Controller was automatically created with CRUD operations. The Views were automatically created (open 'Views' and you will see a subfolder, 'Movies', and then 'Create,' 'Delete,' 'Details,' 'Edit.')


Step Six: Add Movies to Web App Display


Now we want to add a link to our main page to add or delete a movie.

1. Select Views->Shared->_Layout.cshtml





2. Find the code for the navgation bar under <div class = ''navbar-collapse collapse''>. After that line, simply add the following code:

@Html.ActionLink( displayed,view Name,folder name)



3. Now that you have displayed movies, you will be taken to the Movies index page.


Step Seven: Create a Server on Azure


Now we are ready to create a server on Azure.

1. Go to Azure . If you have closed that tab or browser, log in again. Important: Do not close Visual Studio!

2. Go to New->Data+Storage->SQL Database. Fill in the empty fields.







3. Name your database and click on Server->Create a new server. Add server name, admin, password and your location (just like for App Service location).



4. Click ‘OK’.







5. Remember your server name, admin login and password. In my example, it is ooadexample.database.windows.net. Select ‘Create’.







You will see that Azure is creating the database. Wait for it to finish.




Step Eight: Create Connection Strings


1. Select your database. Under the label ‘Connection Strings’, click on ‘Show database connection strings.’ Select the link in the ADO.NET box and copy it.







2. Go back to Visual Studio. Right click on ‘Project’ and click ‘Publish.’







3. This action launches the ‘Publish Web’ window. Paste the previously copied connection string into the ApplicationDbContext and MoviesDbContext fields. Then click on the three dots (…).]







4. The fields should automatically populate the correct information in the Destination Connection String window shown below. If not, enter your server name (in my example: ooadexample.database.windows.net) and password. Check ‘Save my password.’ Important: if password is not filled, enter your password and check “Save my password”.







5. Select ‘OK’.


Step Nine: Test the Published App


Your app will now open in your browser.

1. Click on ‘Movies.’







2. Test it by adding a title, release date, genre and price. Enter mm/dd/yyyy (American date time settings).







3. Creating a title here will also add it to your database on Azure. Close the tab and reopen it again to verify.






Step Ten: Verify Data in Azure


1. To verify that the movie data you entered in Step Nine appears in your Azure database, go to Visual Studio. Under ‘Cloud Explorer’, right-click on your database and click ‘Open in SQL Server Object Explorer’.







2. Now enter your server name, admin and password. Click ‘Connect’.







3. Once connected, you will see that the migration has indeed occurred.







Now you know how to upload an MVC web app to Azure using Entity framework and CRUD. I hope you've found it useful!

Microsoft Imagine, anywhere, anytime:

  • Follow us on Twitter , Facebook , Instagram and YouTube .

  • Subscribe to our blog to meet students just like you who are changing the world with their exciting new tech. Plus, stay on top of all the new products and offerings for students.

  • Get inspiration delivered to your inbox via our monthly Microsoft Imagine Newsletter , featuring the latest tech tips, competition news and all kinds of online tutorials.

  • Bookmark Microsoft Imagine for all the student developer news, downloads to free student products, online tutorials and contests you could want.