This Ruby on Rails sample shows how to use the Contacts API to work with personal contacts.
Open a browser and navigate to the Azure Active Directory admin center. Login using a personal account (aka: Microsoft Account) or Work or School Account.
Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.
Select New registration. On the Register an application page, set the values as follows.
Outlook Contacts VCF Tool
.Web
and set the value to http://localhost:3000/auth/microsoft_graph_auth/callback
.Select Register. On the Ruby Graph Tutorial page, copy the value of the Application (client) ID and save it, you will need it in the next step.
Select API permissions under Manage. Select Add a permission. Select Microsoft Graph, then Delegated permissions. Add the Contacts.ReadWrite permission, then select Add permissions.
Select Certificates & secrets under Manage. Select the New client secret button. Enter a value in Description and select one of the options for Expires and select Add.
Copy the client secret value before you leave this page. You will need it in the next step.
Important: This client secret is never shown again, so make sure you copy it now.
The sample reads the app ID and secret from the Rails credentials API. You need to add these values to the credentials.yml.enc file.
Open your command-line interface (CLI) in the ./vcftool directory.
Run the following command to edit credentials:
rails credentials:edit
Note: If you receive an error
No $EDITOR to open file in
, you need to configure a text editor in theEDITOR
environment variable. For more information, runrails credentials:help
or visit Securing Rails Applications.
Add the following to the credentials file and save it.
# Azure
azure:
app_id: c9fb1bd9-ecc1-4c8a-a945-8f587dc95826
app_secret: Y7UjylVrdEBiPuIiRz@[email protected]:OX205@
bundle install
to install dependencies.bundle exec rake db:setup
to setup the database.rails server
to run the sample.Copyright (c) Microsoft. All rights reserved.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
Connect with me on Twitter @JasonJohMSFT