Monday, 10 February 2025

Get ServiceNow incident data using OAuth in Postman

In this blog, we will be learning about how to get ServiceNow incident ticket details using OAuth authentication in Postman.

Please follow the below steps:

Register OAuth application in ServiceNow

Before using OAuth in Postman, we must set up an OAuth provider in ServiceNow. Here's how to do that:

1). Log in to your ServiceNow instance as an administrator.
2). Open System OAuth > Application Registry.



3). Click on New and select Create an OAuth API endpoint for external clients.


4). Fill in the necessary fields:

Name: A descriptive name - "Postman OAuth App".
Client ID: A unique identifier for your application.
Client Secret: A secret key generated for your app.


5). Save the record and take note of the Client ID and Client Secret as you'll need them in Postman.

Get OAuth Token in Postman

Once your OAuth application is registered in ServiceNow, you'll use it to obtain an access token in Postman.

1). Open Postman.
2). Set the HTTP Method to POST.
3). Request URL is https://dev29xxxx.service-now.com/oauth_token.do
4). Go to the Body tab.
5). Fill in the details:

Key Value
grant_type password
client_id 58au69vbbe3771xxx2ab5793c46cd2xxxbb
client_secret Vb!2,69C5V|fAU
username admin
password AwdVmIseR4h*J4@

6). Click Send button to obtain the token.


Make a Request to Get Incident Data

1). Open Postman.
2). Set the HTTP Method to GET.
3). Request URL is:

https://dev29xxxx.service-now.com/api/now/table/incident?sysparm_limit=5&sysparm_query=active=true^ORDERBYDESCnumber&caller_id.email=david.miller@example.com&sysparm_fields=number,sys_created_on,urgency,state,short_description

4). Go to the Headers tab.
5). Fill in the details:

Key Value
Content-Type application/json
Accept application/json
Access-Control-Allow-Origin *
Authorization Bearer [access_token_value]

6). Click Send button to obtain the token.


View the Response

If everything is configured correctly, Postman will return a JSON response with the incident data from ServiceNow.


I hope this will help all of you! 🧲
Feel free to provide feedback.

Thursday, 2 January 2025

Migrate from an existing Run As Account to Managed identities

In this blog, we will be learning about migrating from an existing 'Run As Accounts' to Managed identities.

Sign in to the Azure portal with an account that’s a member of the subscription Administrator role or a Co-Administrator of the subscription.

The managed identities are of two types system assigned or user assigned.


Steps to be followed to migrate an existing 'Run As Accounts' to Managed identities:

Step 1: Identify the 'Run as accounts' getting expired.


Step 2: Check current role assignments for 'Run as account'.

Click on Run As Account from the screen above, it will show properties of it and at the bottom it will list out the roles.


Step 3: Create System Assigned Managed Identity.

Now we need to create the Managed Identity to migrate to. Go to the Automation Account and select Identity in the left navigation. It will allow to create a new System assigned, or User assigned managed identity.

Create a new System assigned managed identity. Click On and save it, Azure will automatically create the managed identity.


Once it finishes creating the managed identity, we can see the Object ID. Now, we can begin assigning permissions.


Step 4: Assign permissions to Managed Identity.

Click on Azure Role Assignments on the newly created managed identity. Add the same permissions (Step 2) as existing RunAs account had.


Once finished, we can see the role assignments assigned to the new managed identity (it will take some time to display roles assigned).


Step 5: Update credentials

Go to the Automation Account and select Credentials in the left navigation.


Select and update the Password and Confirm Password with App Secret value.
(Open App Registrations and create new client secret. Copy the client secret value and use it above)

Select Save.



⊛ Note

No need to do any changes in the Runbook code to use managed identities.


Step 6: Delete the 'Run As Account'

The final task is to clean up the RunAs resources. Go to the 'Automation Account' > 'Run As Accounts' and then click Delete.


Once finished, we will see that our existing automation account no longer has any Run As Accounts tied to it. It will also be deleted from the Azure Active Directory (AAD).



Refer Microsoft documentation for more
https://learn.microsoft.com/en-us/azure/automation/migrate-run-as-accounts-managed-identity


I hope this will help all of you! 🧲
Feel free to provide feedback.