Skip to content

Commit 577721d

Browse files
Merge pull request #259715 from shikhagarg1/main
SPN access token changes
2 parents 425aed0 + 4f0d9f5 commit 577721d

File tree

4 files changed

+28
-61
lines changed

4 files changed

+28
-61
lines changed

articles/energy-data-services/concepts-authentication.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ In the OSDU instance,
2424
2. The first Service Principal is used for API access. It can also manage infrastructure resources.
2525
3. The second Service Principal is used for service-to-service (S2S) communications.
2626

27-
27+
## Refresh Auth Token
28+
You can refresh the authorization token using the steps outlined in [Generate a refresh token](how-to-generate-refresh-token.md).

articles/energy-data-services/how-to-convert-segy-to-ovds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ If the user isn't part of the required group, you can add the required entitleme
9292

9393
[![Screenshot that shows the API call to get register a user as an admin in Postman.](media/how-to-convert-segy-to-vds/postman-api-add-user-to-admins.png)](media/how-to-convert-segy-to-vds/postman-api-add-user-to-admins.png#lightbox)
9494

95-
If you haven't yet created entitlements groups, follow the directions as outlined in [How to manage users](how-to-manage-users.md). If you would like to see what groups you have, use [Get entitlements groups for a given user](how-to-manage-users.md#get-entitlements-groups-for-a-given-user-in-a-data-partition). Data access isolation is achieved with this dedicated ACL (access control list) per object within a given data partition.
95+
If you haven't yet created entitlements groups, follow the directions as outlined in [How to manage users](how-to-manage-users.md). If you would like to see what groups you have, use [Get entitlements groups for a given user](how-to-manage-users.md#get-osdu-groups-for-a-given-user-in-a-data-partition). Data access isolation is achieved with this dedicated ACL (access control list) per object within a given data partition.
9696

9797
### Prepare Subproject
9898

articles/energy-data-services/how-to-convert-segy-to-zgy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ If the user isn't part of the required group, you can add the required entitleme
126126

127127
[![Screenshot that shows the API call to get register a user as an admin in Postman.](media/how-to-convert-segy-to-zgy/postman-api-add-user-to-admins.png)](media/how-to-convert-segy-to-zgy/postman-api-add-user-to-admins.png#lightbox)
128128

129-
If you haven't yet created entitlements groups, follow the directions as outlined in [How to manage users](how-to-manage-users.md). If you would like to see what groups you have, use [Get entitlements groups for a given user](how-to-manage-users.md#get-entitlements-groups-for-a-given-user-in-a-data-partition). Data access isolation is achieved with this dedicated ACL (access control list) per object within a given data partition.
129+
If you haven't yet created entitlements groups, follow the directions as outlined in [How to manage users](how-to-manage-users.md). If you would like to see what groups you have, use [Get entitlements groups for a given user](how-to-manage-users.md#get-osdu-groups-for-a-given-user-in-a-data-partition). Data access isolation is achieved with this dedicated ACL (access control list) per object within a given data partition.
130130

131131
### Prepare Subproject
132132

articles/energy-data-services/how-to-manage-users.md

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In this article, you learn how to manage users and their memberships in OSDU gro
2525
2. Locate `tenant-id` under the basic information section in the *Overview* tab.
2626
3. Copy the `tenant-id` and paste it into an editor to be used later.
2727

28-
:::image type="content" source="media/how-to-manage-users/azure-active-directory.png" alt-text="Screenshot of search for Microsoft Entra I D.":::
28+
:::image type="content" source="media/how-to-manage-users/azure-active-directory.png" alt-text="Screenshot of search for Microsoft Entra ID.":::
2929

3030
:::image type="content" source="media/how-to-manage-users/tenant-id.png" alt-text="Screenshot of finding the tenant-id.":::
3131

@@ -73,7 +73,7 @@ A `client-secret` is a string value your app can use in place of a certificate t
7373
:::image type="content" source="media/how-to-manage-users/data-partition-id-second-option.png" alt-text="Screenshot of finding the data-partition-id from the Azure Data Manager for Energy instance overview page.":::
7474

7575
:::image type="content" source="media/how-to-manage-users/data-partition-id-second-option-step-2.png" alt-text="Screenshot of finding the data-partition-id from the Azure Data Manager for Energy instance overview page with the data partitions.":::
76-
## Generate access token
76+
## Generate service principal access token
7777

7878
1. Run the below curl command in Azure Cloud Bash after replacing the placeholder values with the corresponding values found earlier in the above steps.
7979

@@ -107,23 +107,18 @@ curl --location --request POST 'https://login.microsoftonline.com/<tenant-id>/oa
107107
1. Find the 'object-id' (OID) of the user(s) first. If you are managing an application's access, you must find and use the application ID (or client ID) instead of the OID.
108108
2. Input the `object-id` (OID) of the users (or the application or client ID if managing access for an application) as parameters in the calls to the Entitlements API of your Azure Data Manager for Energy instance.
109109

110-
:::image type="content" source="media/how-to-manage-users/azure-active-directory-object-id.png" alt-text="Screenshot of finding the object-id from Microsoft Entra I D.":::
110+
:::image type="content" source="media/how-to-manage-users/azure-active-directory-object-id.png" alt-text="Screenshot of finding the object-id from Microsoft Entra ID.":::
111111

112112
:::image type="content" source="media/how-to-manage-users/profile-object-id.png" alt-text="Screenshot of finding the object-id from the profile.":::
113113

114114
## First time addition of users in a new data partition
115-
In order to add entitlements to a new data partition of Azure Data Manager for Energy instance, use the SPN token of the app that was used to provision the instance. If you try to directly use user tokens for adding entitlements, it results in 401 error. The SPN token must be used to add initial users in the system and those users (with admin access) can then manage additional users.
116-
117-
The SPN is generated using client_credentials flow
118-
```bash
119-
curl --location --request POST 'https://login.microsoftonline.com/<tenant-id>/oauth2/token' \
120-
--header 'Content-Type: application/x-www-form-urlencoded' \
121-
--data-urlencode 'grant_type=client_credentials' \
122-
--data-urlencode 'scope=<client-id>.default' \
123-
--data-urlencode 'client_id=<client-id>' \
124-
--data-urlencode 'client_secret=<client-secret>' \
125-
--data-urlencode 'resource=<client-id>'
126-
```
115+
1. In order to add entitlements to a new data partition of Azure Data Manager for Energy instance, use the access token of the app that was used to provision the instance.
116+
2. Get the service principal access token using [Generate service principal access token](how-to-manage-users.md#generate-service-principal-access-token).
117+
3. If you try to directly use user tokens for adding entitlements, it results in 401 error. The service principal access token must be used to add initial users in the system and those users (with admin access) can then manage more users.
118+
4. Use the service principal access token to do these three steps using the commands outlined in the following sections.
119+
5. Add the users to the `users@<data-partition-id>.<domain>` OSDU group.
120+
6. Get the OSDU group such as `service.legal.editor@<data-partition-id>.<domain>` you want to add the user to.
121+
7. Add the users to that group.
127122

128123
## Get the list of all available groups in a data partition
129124

@@ -135,13 +130,13 @@ Run the below curl command in Azure Cloud Bash to get all the groups that are av
135130
--header 'Authorization: Bearer <access_token>'
136131
```
137132

138-
## Add user(s) to an OSDU group in a data partition
133+
## Add users to an OSDU group in a data partition
139134

140135
1. Run the below curl command in Azure Cloud Bash to add the user(s) to the "Users" group using the Entitlement service.
141136
2. The value to be sent for the param **"email"** is the **Object_ID (OID)** of the user and not the user's email.
142137

143138
```bash
144-
curl --location --request POST 'https://<URI>/api/entitlements/v2/groups/users@<data-partition-id>.dataservices.energy/members' \
139+
curl --location --request POST 'https://<URI>/api/entitlements/v2/groups/<group-name>@<data-partition-id>.dataservices.energy/members' \
145140
--header 'data-partition-id: <data-partition-id>' \
146141
--header 'Authorization: Bearer <access_token>' \
147142
--header 'Content-Type: application/json' \
@@ -151,7 +146,7 @@ Run the below curl command in Azure Cloud Bash to get all the groups that are av
151146
}'
152147
```
153148

154-
**Sample request**
149+
**Sample request for `users` OSDU group**
155150

156151
Consider an Azure Data Manager for Energy instance named "medstest" with a data partition named "dp1"
157152

@@ -174,52 +169,23 @@ Consider an Azure Data Manager for Energy instance named "medstest" with a data
174169
"role": "MEMBER"
175170
}
176171
```
177-
> [!IMPORTANT]
178-
> The app-id is the default OWNER of all the groups.
179-
:::image type="content" source="media/how-to-manage-users/appid.png" alt-text="Screenshot of app-d in Microsoft Entra ID.":::
180-
181-
## Add user(s) to an entitlements group in a data partition
182-
183-
1. Run the below curl command in Azure Cloud Bash to add the user(s) to an entitlement group using the Entitlement service.
184-
2. The value to be sent for the param **"email"** is the **Object_ID (OID)** of the user and not the user's email.
185-
172+
**Sample request for `legal service editor` OSDU group**
186173
```bash
187-
curl --location --request POST 'https://<URI>/api/entitlements/v2/groups/service.search.user@<data-partition-id>.dataservices.energy/members' \
188-
--header 'data-partition-id: <data-partition-id>' \
189-
--header 'Authorization: Bearer <access_token>' \
190-
--header 'Content-Type: application/json' \
191-
--data-raw '{
192-
"email": "<Object_ID>",
193-
"role": "MEMBER"
194-
}'
195-
```
196-
197-
198-
**Sample request**
199-
200-
Consider an Azure Data Manager for Energy instance named "medstest" with a data partition named "dp1".
201-
202-
```bash
203-
curl --location --request POST 'https://medstest.energy.azure.com/api/entitlements/v2/groups/[email protected]/members' \
174+
curl --location --request POST 'https://medstest.energy.azure.com/api/entitlements/v2/groups/[email protected]/members' \
204175
--header 'data-partition-id: medstest-dp1' \
205176
--header 'Authorization: Bearer abcdefgh123456.............' \
206177
--header 'Content-Type: application/json' \
207178
--data-raw '{
208-
"email": "90e0d063-2f8e-4244-860a-XXXXXXXXXX",
209-
"role": "MEMBER"
210-
}'
179+
"email": "90e0d063-2f8e-4244-860a-XXXXXXXXXX",
180+
"role": "MEMBER"
181+
}'
211182
```
212183

213-
**Sample response**
214-
215-
```JSON
216-
{
217-
"email": "90e0d063-2f8e-4244-860a-XXXXXXXXXX",
218-
"role": "MEMBER"
219-
}
220-
```
184+
> [!IMPORTANT]
185+
> The app-id is the default OWNER of all the groups.
186+
:::image type="content" source="media/how-to-manage-users/appid.png" alt-text="Screenshot of app-d in Microsoft Entra ID.":::
221187

222-
## Get entitlements groups for a given user in a data partition
188+
## Get OSDU groups for a given user in a data partition
223189

224190
1. Run the below curl command in Azure Cloud Bash to get all the groups associated with the user.
225191

@@ -259,10 +225,10 @@ Consider an Azure Data Manager for Energy instance named "medstest" with a data
259225
}
260226
```
261227

262-
## Delete entitlement groups of a given user in a data partition
228+
## Delete OSDU groups of a given user in a data partition
263229

264230
1. Run the below curl command in Azure Cloud Bash to delete a given user from a given data partition.
265-
2. As stated above, **DO NOT** delete the OWNER of a group unless you have another OWNER who can manage users in that group.
231+
2. **DO NOT** delete the OWNER of a group unless you have another OWNER who can manage users in that group.
266232

267233
```bash
268234
curl --location --request DELETE 'https://<URI>/api/entitlements/v2/members/<OBJECT_ID>' \

0 commit comments

Comments
 (0)