This code sample is one of three referenced in the Azure AD sessions of the Microsoft Cloud Roadshow. Recordings of these sessions will be available shortly here. We recommned you watch one of these recordings to understand the purpose and goals of this code sample.
To-Do List Reimagined (tdlr;) is a new cloud service that allows users to store and manage a list of tasks. It integrates with Azure AD in order to provide enterprise features to its customers that have an existing Azure AD tenant. These features include:
The full service consists of three different sample projects:
At this point in time, the tdlr; app will only run on iOS - which means that you will need a mac on which to deploy the code. In addition, you will need to download & install Xamarin on your machine. This code sample was built using Xamarin Studio, which is installed by default when your install Xamarin on your machine. You are free to use Visual Studio on a Windows machine and remote connect to the Xamarin.iOS build host via wifi - but setting up your development environment will be a bit more involved.
This sample Xamarin application is written to be used with the tdlr; web app as its backend data storage service. Before proceeding, you will need to create your own instance of the service by following the instructions for the tdlr web app and host it somewhere where your iOS app can communicate with it - we recommend deploying it as an Azure web app.
If you don't want to spin up your own tdlr; service, you can instead use our instance as a workaround. To sign up for our tdlr; service, open this link in a new tab. Sign in with a user in your development tenant. This process will add our tdlr; service to your tenant so you can configure your app to access it. Note that you will need to repeat this process for each tenant that you use to sign into your iOS app (we told you it was a workaround).
You'll now need to register your Xamarin app in the Azure Management Portal so that your version of tdlr; can sign users in and get information from Azure AD. In order to do so, you will need an Azure Subscription. If you don't already have an Azure subscription, you can get a free subscription by signing up at http://azure.com. All of the Azure AD features used by this sample are available free of charge.
You'll also need an Azure Activce Directory tenant in which to register your application. Every Azure subscription has an associated tenant, which you are free to use. You may also wish to create an additional tenant, since the tdlr; app is 'multi-tenant' - it allows users from any organization to sign up & sign in. You'll want to create a few users in your tenant(s) for testing purposes - a guest user with a personal MSA account will not work for this sample.
http://tdlr. Click finish.
Access the directory as the signed-in userpermission. Your app should now show two delegated permission.
Note: if you can't find the TDLR; web app in this menu, read the above section. You'll first need to spin up your own instance of the tdlr; web service, or sign up for ours.
In order for the Xamarin app to work across many tenants, you will need to explicitly bind the client app registration in Azure AD with the registration for the web API. You can do so by adding the "Client ID" of the Xamarin app, to the manifest of the web app.
Note: if you are using our instance of the tdlr; service, you can skip this section. But remember you will have to perform the workaround described above for every tenant which you want to use to sign into the app.
Retrieve the application manifest file for the tdlr; web app you registered
In the manifest, locate the
knownClientApplications array property, and add the Client ID for your Xamarin app as an element. Your code should look like the following after you're done:
Save the tdlr; web app manifest back to your Azure AD tenant by
Now you can download this repo as a zip or clone it to your local machine:
git clone https://github.com/azureadsamples/azureroadshow-xamarin
In your local repo, open the
tdlr.sln file in Xamarin Studio.
To run the app, you'll need to enter the information from your app registration. In Xamarin Studio, open the
tdlr/tdlr.cs file in the root of the project and locate the app config properties. Replace the following values with your own:
// App Config Values public static string clientId = "[Enter your client ID as registered in the Azure Management Portal, e.g. 3d8c4803-ffcd-4b2a-baec-05056abdc408]"; public static string taskApiResourceId = "https://strockisdevtwo.onmicrosoft.com/tdlr";
Also open the
tdlr/utils/TaskHelper.cs file, and edit the value of the
taskApi property to the base address of your tdlr web app.
Note: if you are using our instance of the tdlr; service, leave the default value of the
taskApi as they are.
You can now run the tdlr; app and explore its functionality. Try signing up and signing in with your Azure AD users, creating tasks, and sharing them with other users. To understand the code behind the app, we recommend you watch on of the recorded Microsoft Cloud Roadshow sessions which will be available soon here. If you're already familiar with Azure AD, you may find the code comments instructive as well.