Develop Azure Platform as a Service Compute Solutions
This is Part 2 of the AZ-203 study guide. In this post we'll cover:
This is the 2nd module measured in the AZ-203 exam.
App Service Web Apps
Create a resource group
az group create -n "my-rg-apps" -l westus
Create an App Service plan
appservice plan create
-n "githubdeployplan"
-g "rg-apps"
--sku FREE # {B1, B2, B3, D1, F1, FREE, I1, I2...
--is-linux
Create a web app
az webapp create
-n "myapp"
-g "rg-apps"
--plan "githubdeployplan"
--deployment-container-image-name "microsoft/dotnet-samples:aspnetapp"
Mobile Apps
Enabling offline sync for a mobile app
public async Task SyncAsync()
{
try {
await client.SyncContext.PushAsync(); // ⚠️
// Reconcile local <-> server
await todoTable.PullAsync( // ⚠️
"allTodoItems",
this.todoTable.CreateQuery());
}
catch (MobileServicePushFailedException ex){
if (ex.PushResult != null) {
syncErrors = ex.PushResult.Errors.
}
}
}
📖 Further reading: Offline Data Sync in Azure Mobile Apps
Azure Functions
// ⚠️ Functions with a [QueueTrigger] attribute process Storage Queues messages
// ⚠️ Functions with a [Table] attribute will output to a Storage Table.
[FunctionName("ProcessOrders")]
public static void ProcessOrders(
[QueueTrigger("incoming-orders"),
Connection = "AzureWebJobsStorage"]
CloudQueueMessage queueItem,
[Table("Orders",
Connection = "AzureWebJobsStorage")]
ICollector <Order> tableBindings,
ILogger log)
{
//...
💡 If a function throws an exception it will be called a maximum of 4 additional retries.
💡 Azure Functions runtime will receive up to 16 messages and run functions for each in parallel.
💡 When the number being processed gets down to 8, the runtime gets another batch of 16 messages.
📖 Further reading: Azure Queue storage trigger for Azure Functions
Next up...
Go to Part 3 of the series for Developing for Azure Storage