Coder Social home page Coder Social logo

azure-samples / xamarin-azure-businessreview Goto Github PK

View Code? Open in Web Editor NEW
46.0 19.0 19.0 1.32 MB

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

License: MIT License

C# 100.00%
xamarin-forms azure-functions azure-storage azure-services azure-ad-b2c azure-media-services xamarin

xamarin-azure-businessreview's Introduction

page_type languages products description name
sample
csharp
dotnet
xamarin
azure
azure-functions
azure-active-directory
azure-cosmos-db
azure-storage
azure-media-services
This is a Xamarin app that gives users the opportunity login and create reviews for businesses and or restaurants.
The Business Reviewer (Xamarin)

The Business Reviewer

logo

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.

Features

This project demonstrates the following:

Getting Started

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.

Prerequisites

Installation

  • Clone this repository.
  • Open the /src/Reviewer.sln in either Visual Studio or Visual Studio for Mac.
  • Restore all NuGet packages.

Quickstart

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:

Azure Storage

  1. Create an Azure Storage Account.

Azure AD B2C

Setting up Azure AD B2C is the most involved portion.

  1. First you need to create the tenant.
  2. Next you need to create your application.
    1. Within the application, create a scope, and name it rvw_all.
  3. Next you need to add any identity providers.
  4. Then you need to create a sign-up/sign-in policy.

Azure Cosmos DB

  1. Create an Azure Cosmos DB - SQL API - instance.
    1. Create a database named: BuildReviewer
  2. Create a collection named: Businesses
  3. Create a collection named: Reviews

Azure App Service

  1. Create the Azure App Service.

  2. 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"
    }
    • The ClientId value will be the Application ID of your Azure AD B2C application.
    • The Domain will be the Domain Name of your Azure AD B2C tenant.
    • The SignUpSignInPolicyId will be the name of the sign-up/sign-in policy you created.
  3. Update the following variable values in Reviewer.Services.APIKeys:

    1. CosmosEndpointUrl: Obtained from the API Keys blade of the portal for Cosmos DB.
    2. CosmosAuthKey: The primary key from the API Keys blade of the portal for Cosmos DB.
    3. 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.)
  4. Deploy the Reviewer.WebAPI ASP.NET Core Web API application to the Azure App Service instance.

Azure Media Services (AMS)

  1. Create an Azure Media Services instance.
  2. Use the same Azure Storage account as created above.
  3. Start the default streaming endpoint.
  4. Create an Azure AD application for it.
  5. Create an Azure AD service principal.

Azure Functions

  1. Create an Azure Function App.
  2. Use the same Azure Storage account as created above.
  3. Create the following Application Settings keys with values:
    1. AMSAADTenantDomain: The Azure AD domain you created for the AMS app in step 4 in the Azure Media Services setup above.
    2. AMSClientId: The Azure AD client ID for the Azure Media Services application you created during the Azure Media Services setup above.
    3. AMSClientSecret: The secret key obtained during the Azure Media Services AD creation steps above.
    4. AMSRESTAPIEndpoint: Obtained on the Azure Media Services overview blade in the portal.
    5. MediaServicesStorageAccountKey: Obtained on the Primary Storage ID of the AMS Properties blade.
    6. MediaServicesStorageAccountName: Obtained on the Primary Storage Name of the AMS Properties blade.
    7. Reviews_Cosmos: The Azure Cosmos DB connection string (obtained on the keys blade for Cosmos DB).
    8. 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.

Xamarin.Forms Project

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.

  1. In the Reviewer.Services.APIKeys class fill in the values for the following variables:
    1. SASRetrievalUrl: The function URL of the SASRetrievalURL function.
    2. WriteToQueueUrl: The function URL of the WritePhotoInfoToQueue function.
    3. StorageAccountName: Within the Azure Storage service - the Storage Account Name as found on Access Keys blade.
    4. PhotosContainerName: review-photos

Demo

There are a couple things to note when running the demo.

  1. The Xamarin.Forms app needs to run with an Android version that supports custom tabs.

xamarin-azure-businessreview's People

Contributors

brminnick avatar codemillmatt avatar dependabot[bot] avatar microsoftopensource avatar msftgits avatar supernova-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xamarin-azure-businessreview's Issues

Update MSAL to 1.1.4-preview

Minimal steps to reproduce:
Clone and build the repo. Try to update Nuget package for MSAL and get an error that the source is not found for Nuget packages in Reviewer.Droid and Reviewer.iOS. Customer cannot update MSAL nuget package.

image

Expected behavior:
User can update MSAL through Nuget Package Manager. Please update MSAL to 1.1.4-preview.
We have released MSAL 1.1.3-preview, which includes support for Xamarin.Android.Support 27.0.2 and MonoAndroid8.1. Thank you!

Trouble getting sample to compile and run

  • [ X ] bug report -> please search issues before submitting

This might be user error and not a bug, but I've tried on both windows and mac and have gotten blocked on both platforms. I'm running on a Macbook with a Windows 10 VM. I've tried building the solution in both OSes.

Minimal steps to reproduce

Download the sample zip from docs here https://docs.microsoft.com/en-us/samples/azure-samples/xamarin-azure-businessreview/the-business-reviewer/
Extract the zip file and open the Solution in either VS2019 on Windows or Mac

Any log messages given by the failure

This sample is using the obsolete UIParent class and to remove it is fairly complicated. I started doing it, but quickly became lost in changes needed.

Error | CS0619 | 'UIParent' is obsolete: 'In MSAL.NET 3.x, you should directly pass the Activity (on Xamarin.Android), or Window (on .NET Framework and UWP) using AcquireTokenInteractiveParameterBuilder.WithParentActivityOrWindowSee https://aka.ms/msal-net-3-breaking-changes' | Reviewer.Droid | C:\Users\Scott\Documents\Visual Studio 2019\Strawberry\src\Droid\MainActivity.cs

Expected/desired behavior

OS and Version?

Windows 10 and macOS Catalina (10.15.2)

Task "MSdeploy" skipped, due to false condition

Hi. Thanks for the sample. Trying desperately to get this going for a week. I am getting the following error when deploying Reviewer.WebAPI to the Azure App Service instance:

This papwineonlineappservice.azurewebsites.net page can’t be found No webpage was found for the web address: http://papwineonlineappservice.azurewebsites.net/

Could it have something to do with this build output?

Task "MSdeploy" skipped, due to false condition; ('$(UseMsdeployExe)' == 'true') was evaluated as ('' == 'true').

Other than this, I am flummoxed... created Storage Account, Tenant and application "X", Signin policy in the tenant, Cosmos DB and collections, clicked on app services in the main directory, added "Web App" "Y", added application ID of "X" and signupsignin policy and included trailing backslash at end of WebAPIUrl "Y".

Deploy.... nada.

Cleaned Chrome cache, restarted vs, signed out of Azure etc... nada

Anyone got this going that has any pointers? Sure I'm missing something big here :-)

suggestion : missing feature

Hi,

It looks nice, but there are some missing features, like:

1 - facebook authentication
2 - email/password registration
3 - forgot email feature

It will be great to have an example of how to have a correct authentication and secure app with Xamarin.

Thanks

Compilation issue

Hi,

I just open the solution, compile and got the following compilation issue :

6>C:\Temporary\xamarin-azure-businessreview-master\src\iOS\AppDelegate.cs(9,17,9,25): error CS0234: The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.