REST API Manual Configuration

REST API Manual Configuration

This topic discusses how to manually configure REST API for use with Nerdio Manager.

Default REST API Status in Nerdio Manager

By default, when you install Nerdio Manager, the REST API is disabled.

To verify the REST API status:

  1. In Nerdio Manager navigate to Settings > Integrations.

  2. In the REST API tile, view the status.

Update the Nerdio-nmw-app Manifest

You must update the Nerdio-nmw-app Manifest file with required information.

To update the Nerdio-nmw-app Manifest:

  1. In the Azure portal, navigate to App registrations.

  2. Search for and select Nerdio-nmw-app.

  3. In Overview, copy the Application (client) ID.

  4. In the Manage blade, select Manifest.

  5. Add the following line:

    "identifierUris": ["api://<app_id>"],

  6. Change "accessTokenAcceptedVersion" from null to 2.

    Note: Your Manifest file should look like this:

  7. Save the Manifest file.

Add an Application ID URI

If the Application ID URI is not set, then you need to add it.

Note: An example of an Application ID URI is api://g0cb288e-ff16-1861-9393-50219a19453c.

To add an application ID URI:

  1. In the Azure portal, navigate to App registrations.

  2. Search for and select Nerdio-nmw-app.

  3. Select Overview.

  4. Select Add an Application ID URI.

  5. Select Add and then select Save.

  6. Once these changes are added and saved in the Azure portal, in Nerdio Manager navigate to Settings > Integrations.

  7. In the REST API tile, next to Credentials, select the info icon .

  8. Close this info pop-up and follow the steps below to complete the REST API configuration.

Create a new App Registration

The next step is to create and configure a new application registration in the Azure portal.

To create a new app registration:

  1. In the Azure portal, navigate to App registrations.

  2. Select + New registration.

  3. Enter the following information:

    • Name: Type the name of the new App Registration.

    • Leave the defaults for the other parameters.

  4. Once you have entered the desired information, select Register.

    The application is registered and you are taken to the configuration of your newly created application.

Update the new App Registration

The next step is to update the new app registration.

To update the new app registration:

  1. In the Azure portal, navigate to App registrations.

  2. Search for and select Nerdio-nmw-app.

  3. In the Manage blade, select App roles.

  4. Copy the RestClient ID, which is the NME_ID we need.

  5. Navigate back to App registrations.

  6. Select the newly created app registration (RESTApi in our example).

  7. In the Manage blade, select Manifest.

    Tip: Before you make any changes, download a copy of the Manifest in case you make any mistakes.

  8. Locate the section tags, which should look like this:

  9. Within the brackets add the following "NMW_REST_API_CLIENT:<app_id>"

    Note: The modified tags should look like this:

  10. Locate the "requiredResourceAccess", which should look like this before any modifications:

  11. Make the following changes:

    • resourceAppId: This is the App_id we have used throughout the document.

    • id: Is the NME_ID you copied in the previous step.

    • Type: Change this to Role.

  12. Save the Manifest file.

  13. In the Manage blade, select API permissions.

  14. Grant admin consent.

  15. In the Manage blade, select Certificates & secrets.

  16. Select + New client secret.

  17. Enter the following information:

    • Description: Type the description of the client secret.

    • Duration: From the drop-down list, select your desired duration.

  18. Once you have entered all the desired information, select Add.

  19. Copy and save the client secret value, which is needed later on.

Check the REST API State in Nerdio Manager

Once you have completed the steps above in the Azure portal, you must wait a few minutes (important) before checking the REST API state in Nerdio Manager.

To check the REST API state:

  1. After waiting a few minutes, in Nerdio Manager, refresh your session.

  2. Navigate to Settings > Integrations.

  3. In the REST API tile, next to Credentials, select show.

  4. Ensure that your credentials look like the sample shown above.

  5. Select OK to close the credentials pop-up window.

  6. Next to Documentation, select swagger.

  7. In the upper right hand corner of the Swagger page, select Authorize.

  8. Paste the Client Secret value that you previously saved.

  9. Select Authorize.

Test PowerShell

We need the following variables to test the REST API:

  • Client_Secret: This is the Client Secret you previously saved.

  • Client_ID: This can be copied from the Rest API Credentials.

  • Tenant_ID: This can be copied from the Rest API Credentials.

  • NME_Scope: This can be copied from the Rest API Credentials.

  • NME_URL: This is the link to the Nerdio Manager web app.

  • Sub_ID: This can be copied from Settings > Azure environment > Azure subscriptions tile.

To test a PowerShell script:

  1. Create and save a PowerShell script with the following commands using the variables you just copied. In this example, we are saving REST-API.ps1.

    # Install NerdioManager Powershell module

    Install-Module -Name NerdioManagerPowerShell

    # Setup few variables

    # Client_Secret is the secret you created for the newly App Registration

    $NMEClientSecret = "<Client_Secret>"

    # Client_ID can be copied from NME Rest API Credentials

    $NMEClientId = "Client_ID"

    # Tenant_ID can be copied from NME Rest API Credentials

    $NMETenantId = "<Tenant_ID>"

    # NME_Scope can be copied from NME Rest API Credentials

    $NMEScope = "<NME_Scope>"

    # NME_URL is the link to the NME web app

    $nMEuRI = "<NME_URL>"

    # Sub_ID can be copied from NME > Settings > Azure Environment

    $NMWSubscriptionId = "<Sub_ID>"

    # Connect

    Connect-NME -ClientId $NmeClientId -ClientSecret $NmeClientSecret -TenantId $NmeTenantId -ApiScope $NmeScope -NmeUri $NmeUri

    # List available Workspaces

    Get-nmeworkspace

  2. Open PowerShell with elevated credentials and browse to where you saved the REST-API.ps1 script.

  3. Run the following commands:

    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

     

    .\REST-API.ps1

  4. When prompted, select Yes or Yes to All.

  5. Confirm that you can see the list of available Workspaces.

Postman

See REST API Endpoint Implementation for details.

Was this article helpful?

1 out of 1 found this helpful
Have more questions? Submit a request

Comments (0 comments)

Article is closed for comments.