Demo app showing how to use several Azure services with Xamarin including Azure AD B2C, Azure Cosmos DB, Azure Functions, Azure App Services, and Azure Media Services
page_type: sample
languages:
This is a Xamarin app that gives users the opportunity login and create reviews for businesses and or restaurants. In addition to being able to leave a text review, the user can also upload photos and videos.
The app showcases how to use several Azure offerings in the context of a mobile application - including how to create accounts and stream videos.
This project demonstrates the following:
To get started clone this repository and then follow the directions in the Quick Start section below to setup the Azure infrastructure. Once done, you will be able to run the app.
/src/Reviewer.sln
in either Visual Studio or Visual Studio for Mac.In order to run this full sample, an Azure subscription is required. You can create a free subscription here.
Note: When creating the Azure offerings below - use the same Resource Group. And when given the option to pick a Storage Account - pick the same one for each.
Once you have a subscription, you will need to create several Azure offerings:
Setting up Azure AD B2C is the most involved portion.
rvw_all
.BuildReviewer
Businesses
Reviews
Configure the Reviewer.WebAPI
project’s appsettings.json
file to match the following:
"AzureAdB2C":
{
"Instance": "https://login.microsoftonline.com/tfp/",
"ClientId": "",
"Domain": "",
"SignUpSignInPolicyId": "",
"AllAccessScope": "rvw_all"
}
ClientId
value will be the Application ID of your Azure AD B2C application.Domain
will be the Domain Name of your Azure AD B2C tenant.SignUpSignInPolicyId
will be the name of the sign-up/sign-in policy you created.Update the following variable values in Reviewer.Services.APIKeys
:
CosmosEndpointUrl
: Obtained from the API Keys blade of the portal for Cosmos DB.CosmosAuthKey
: The primary key from the API Keys blade of the portal for Cosmos DB.WebAPIUrl
: The URL of this Azure app service, can be obtained from the overview blade in the portal. (Make sure to include the trailing backslash.)Reviewer.WebAPI
ASP.NET Core Web API application to the Azure App Service instance.AMSAADTenantDomain
: The Azure AD domain you created for the AMS app in step 4 in the Azure Media Services setup above.AMSClientId
: The Azure AD client ID for the Azure Media Services application you created during the Azure Media Services setup above.AMSClientSecret
: The secret key obtained during the Azure Media Services AD creation steps above.AMSRESTAPIEndpoint
: Obtained on the Azure Media Services overview blade in the portal.MediaServicesStorageAccountKey
: Obtained on the Primary Storage ID of the AMS Properties blade.MediaServicesStorageAccountName
: Obtained on the Primary Storage Name of the AMS Properties blade.Reviews_Cosmos
: The Azure Cosmos DB connection string (obtained on the keys blade for Cosmos DB).WebhookEndpoint
: This will need to be obtained after you deploy the Function app. It is the URL of the AMSWebhook function.Note that all of those settings can also be put into your local.settings.json to debug locally.
Finally there are a couple of settings that you need to configure in the Xamarin.Forms project to ensure it can communicate to the Azure offerings.
Reviewer.Services.APIKeys
class fill in the values for the following variables:SASRetrievalUrl
: The function URL of the SASRetrievalURL function.WriteToQueueUrl
: The function URL of the WritePhotoInfoToQueue function.StorageAccountName
: Within the Azure Storage service - the Storage Account Name as found on Access Keys blade.PhotosContainerName
: review-photosThere are a couple things to note when running the demo.