This page documents building a Visual Studio project that uses an Azure Data Table. I will create several YouTube videos to describe the process.
Creating the Project - Create an MVC project under "Projects" in Visual Studio.
- Add a GitHub repository to the project.
- Manage Nuget Packages... and install Azure.Core, Azure.Data.Tables, and Azure.Identity.
- Create a Model to represent the data stored in the table, for example, BlogModel. Every entry in the table is a blog entry. List all the properties of a Blog.
- Add comments to each property of BlogModel making it clear what the property stores. This is the same as descriptions in SharePoint.
- Create a class to handle the data connections, for example, BlogModels. In a larger application, the data layer would be in it's own folder, or even a separate project. For a small website, a single class to represent the data layer is sufficient.
- For each function (Create, Details, Delete, Edit, etc.) create a method in BlogModels that talks to the Data Table.
- Each method of BlogModels must be static.
- Create a method that instantiates the Data Table as a TableEntity. This means your connection info can be exclusively in one method.
- The Populate method is where you assign properties from model to TableEntity.
- Add each function (Create, Details, Delete, Edit, etc.) to HomeController.cs.
- Right-click each function and click Add View to create the view.
- We won't get into CSS.
- Under Options | Azure Service Authentication, choose an account. This allows you to use Microsoft Identity while in local development.
Creating an App Service - Create an App Service in Azure.
- Activate Managed Identity for your App Service.
- Create a Storage Container in Azure.
- Create your Data Table.
- Grant Data Table Contributor rights to your Managed Identity for that Data Table.
- From Visual Studio, Publish to the App Service.
Naming your app as a subdomain - Use Namecheap to create a subdomain or a folder.
- Point that folder to your new app.
Azure Home |