Skip to content

Get AzDO token #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions deployment/azure-service-connection-azdo-access.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
parameters:
- name: azureDevOpsServiceConnection
displayName: Azure DevOps Service Connection
type: string
default: my-azdo-connection
- name: serviceConnection
displayName: Azure Service Connection Name
type: string
Expand Down Expand Up @@ -87,3 +91,23 @@ jobs:
| Select-Object id, name
failOnStandardError: true

- task: PowerShell@2
displayName: 'Get-AzDoToken'
inputs:
azureDevOpsServiceConnection: '${{ parameters.azureDevOpsServiceConnection }}'
targetType: 'inline'
script: |
$token = Get-AzDoToken

Write-Host "`nUse token with Azure DevOps REST API to list pools in the organization '$(System.CollectionUri)'..."
$apiVersion = "7.1-preview.1"
$apiUrl = "$(System.CollectionUri)_apis/distributedtask/pools?api-version=${apiVersion}"
Invoke-RestMethod -Uri $apiUrl `
-Headers @{
Accept = "application/json"
Authorization = "Bearer $token"
"Content-Type" = "application/json"
} `
-Method Get `
| Select-Object -ExpandProperty value `
| Select-Object id, name
29 changes: 29 additions & 0 deletions get-azdo-token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
parameters:
- name: azureDevOpsServiceConnection
displayName: Azure DevOps Service Connection
type: string
default: my-azdo-connection

pool:
vmImage: windows-latest

steps:
- task: PowerShell@2
inputs:
azureDevOpsServiceConnection: '${{ parameters.azureDevOpsServiceConnection }}'
targetType: 'inline'
script: |
$token = Get-AzDoToken

Write-Host "`nUse token with Azure DevOps REST API to list pools in the organization '$(System.CollectionUri)'..."
$apiVersion = "7.1-preview.1"
$apiUrl = "$(System.CollectionUri)_apis/distributedtask/pools?api-version=${apiVersion}"
Invoke-RestMethod -Uri $apiUrl `
-Headers @{
Accept = "application/json"
Authorization = "Bearer $token"
"Content-Type" = "application/json"
} `
-Method Get `
| Select-Object -ExpandProperty value `
| Select-Object id, name
2 changes: 1 addition & 1 deletion scripts/azure-devops
2 changes: 1 addition & 1 deletion scripts/identity
Submodule identity updated 33 files
+0 −41 .github/workflows/docs.yml
+0 −3 Brewfile
+6 −3 README.md
+12 −12 scripts/azure-devops/azure-pipelines.yml
+72 −25 scripts/azure-devops/create-oidctoken.yml
+0 −149 terraform/azure-devops/create-service-connection/.terraform.lock.hcl
+1 −170 terraform/azure-devops/create-service-connection/README.md
+0 −399 terraform/azure-devops/create-service-connection/azure-pipelines.yml
+0 −9 terraform/azure-devops/create-service-connection/backend.tf.sample
+0 −30 terraform/azure-devops/create-service-connection/config.auto.tfvars.sample
+0 −94 terraform/azure-devops/create-service-connection/doc-gen/.terraform-docs.yml
+0 −0 terraform/azure-devops/create-service-connection/doc-gen/footer.md
+0 −107 terraform/azure-devops/create-service-connection/doc-gen/header.md
+ terraform/azure-devops/create-service-connection/graph.png
+0 −118 terraform/azure-devops/create-service-connection/main.tf
+0 −48 terraform/azure-devops/create-service-connection/modules/app-registration/main.tf
+0 −35 terraform/azure-devops/create-service-connection/modules/app-registration/outputs.tf
+0 −21 terraform/azure-devops/create-service-connection/modules/app-registration/variables.tf
+0 −11 terraform/azure-devops/create-service-connection/modules/azure-access/main.tf
+0 −6 terraform/azure-devops/create-service-connection/modules/azure-access/outputs.tf
+0 −7 terraform/azure-devops/create-service-connection/modules/azure-access/terraform.tf
+0 −6 terraform/azure-devops/create-service-connection/modules/azure-access/variables.tf
+0 −20 terraform/azure-devops/create-service-connection/modules/managed-identity/main.tf
+0 −18 terraform/azure-devops/create-service-connection/modules/managed-identity/outputs.tf
+0 −7 terraform/azure-devops/create-service-connection/modules/managed-identity/terraform.tf
+0 −7 terraform/azure-devops/create-service-connection/modules/managed-identity/variables.tf
+0 −22 terraform/azure-devops/create-service-connection/modules/service-connection/main.tf
+0 −15 terraform/azure-devops/create-service-connection/modules/service-connection/outputs.tf
+0 −7 terraform/azure-devops/create-service-connection/modules/service-connection/terraform.tf
+0 −11 terraform/azure-devops/create-service-connection/modules/service-connection/variables.tf
+0 −79 terraform/azure-devops/create-service-connection/outputs.tf
+0 −57 terraform/azure-devops/create-service-connection/terraform.tf
+0 −82 terraform/azure-devops/create-service-connection/variables.tf
Loading