Azure DevOps OAuth organization policies API

Viewed 151

is there a way to know via API what is the organization policy for 3rd party OAuth requests?

i want to know if i should ask my user to authenticate with his credentials or generate PAT

enter image description here

1 Answers

is there a way to know via API what is the organization policy for 3rd party OAuth requests?

You can use this api which I fetched from F12:

Get https://dev.azure.com/{YourOrgName}/_settings/organizationPolicy?__rt=fps&__ver=2

The response would contain the info about Application Connection Policies:

               "ms.vss-admin-web.organization-policies-data-provider": {
                    "policies": {
                        "applicationConnection": [
                            {
                                "policy": {
                                    "name": "Policy.DisallowOAuthAuthentication",
                                    "value": false,
                                    "effectiveValue": true,
                                    "parentPolicy": {
                                        "name": "Policy.DisallowOAuthAuthentication",
                                        "value": false,
                                        "effectiveValue": true,
                                        "isValueUndefined": true
                                    }
                                },
                                "learnMoreLink": "https://aka.ms/vstspolicyoauth",
                                "description": "Third-party application access via OAuth",
                                "applicableServiceHost": 1
                            },
                            {
                                "policy": {
                                    "name": "Policy.DisallowSecureShell",
                                    "value": false,
                                    "effectiveValue": true,
                                    "isValueUndefined": true,
                                    "parentPolicy": {
                                        "name": "Policy.DisallowSecureShell",
                                        "value": false,
                                        "effectiveValue": true,
                                        "isValueUndefined": true
                                    }
                                },
                                "learnMoreLink": "https://aka.ms/vstspolicyssh",
                                "description": "SSH authentication",
                                "applicableServiceHost": 1
                            }
                        ]...

The effectiveValue(not value node) node under corresponding policy node should represent whether you enable/disable the policies above in your pic. E.g: The effectiveValue node under first policy node would be false if the Third-party application access via OAuth is disabled.

Related