This sample was created using create-react-app.
- Register a single page application in the Microsoft identity platform
- Configure the app registration with a redirect URI to specify where the Microsoft identity platform should redirect the client along with any security tokens.
- Follow the instructions at Redirect URI: MSAL.js 1.0 with implicit flow to set the redirect URI to http://localhost:3000
- Please note that
@azure/ms-rest-browserauth
does not support MSAL.js 2.0
- In this sample, we list the subscriptions available in your Azure account and the Storage accounts available in your Azure subscription. For this to work, you need to ensure that your application has the right permission for the
Azure Service Management
andAzure Storage
APIs. To do so, follow the below instructions:- In your app registration in the Azure portal, go to
API Permissions
- Click on
Add a permission
, selectAzure Service Management
and check the box foruser_impersonation
permission - Click on
Add a permission
, selectAzure Storage
and check the box foruser_impersonation
permission
- In your app registration in the Azure portal, go to
- Keep in mind that the account administrator may need to grant admin consent for the Default Directory.
- For more information: Grant admin consent in App registrations.
- Copy "sample.env" as ".env" and add your own clientId, tenantId, and subscriptionId values
- Run
npm install
andnpm start
Some browsers may disable third party cookies by default. Since @azure/ms-rest-browserauth uses Implicit Flow to authenticate, make sure that the browser you use allows third party cookies to be stored.
Please see src/App.tsx for the most relevant example code.