Frequently, developers find ourselves in situations where we have to implement/test Microsoft Azure services. One way to safely test code and do all the necessary testing is to create a test environment within Azure with a development tenant.
Free Azure test environment (Dev Tenant)
The test environment is an ideal scenario to implement and test code
before running it in a production tenant. You will have a subscription with which you can create your own isolated space and develop independent solutions. Work on Azure Active Directory (AAD), create Microsoft Teams applications, Office add-ins for Word, Excel, PowerPoint, Outlook, SharePoint add-ins, use Microsoft Graph, SharePoint Framework and Power Apps, and more.
We will continue with this article based on a practical example.
Let’s imagine that we have a client with a need: from their website, users must be authenticated and managed using Azure Active Directory (AAD). That means that our client has a cloud-based identity and access management service, which we can replicate (to a greater or lesser extent) to our client’s environment, in a simple way, thanks to our development tenant. We will also be able to start the implementation and testing in an agile, realistic and safe way.
Create Azure Test Environment (Development Tenant)
To create a test environment we must access from this link and enter Microsoft 365 Developer. Click on “Join now”, fill in the information requested, and once we have registered we will have a development tenant with 25 trial licenses.
If we enter our Office space, we have all the Apps and test services available, but we’ll focus on the Admin section, from where we can access the administration section of our AAD.
When we click on Admin, it redirects us to the administration section for our development tenant, with the already existing users and groups created automatically at the time of the creation of said environment and with the possibility of directing us to our AAD.
In the AAD Admin Center we have a test Active Directory already configured with sample users and groups to start our implementation and testing.
Continuing with our example, now that we have our test AAD, we can focus on implementing web user authentication and management using the test AAD.
For such an implementation we would use Microsoft Graph. Microsoft Graph is an API for web REST that allows access to the resources of the Microsoft Cloud service, a service available from our test environment. Microsoft Graph is the gateway to Microsoft 365 data and intelligence. For this example, we could use this API to get the organization’s users, access tokens, a given user’s data, their group and CRUD of users/groups, among other types of information.
A little introduction to using Microsoft Graph
Now that we’ve talked about Microsoft Graph (which we just described in the previous section), Graph Explorer is a tool that allows you to comfortably make/fulfill REST API requests, view the responses, and get the corresponding code to use in project deployment.
Find more information about Graph Explorer in the official Microsoft developer docs.
Sample response to request to get all users in the company
Code snippets example
Beyond test environments
Test environments are key to testing new services to be implemented using the Azure structure. I emphasize the word “test”. A test environment, at the end of the day, will not be able to replicate all the scenarios/failures that our solution may face, so it is very important to keep one thing in mind: a test environment is and should always be the first step towards a concrete goal, the full deployment of a solution or, at the very least, exploring improvements we can make for the future, either in the process or our application.
If we never get past the sandbox, we will not move in the direction that every company in the industry should. At the end of the process, we must always obtain a result.
If you want to read a little more about Graph, here is the link, in it you will also find sample codes for several technologies that you can use as a base during the implementation.
Hugo Pascual – Software Developer at Itequia