Git Product home page Git Product logo

azurepipelinesps's People

Contributors

dejulia489 avatar kuulemart avatar olljanat avatar scrthq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azurepipelinesps's Issues

Can't get Copy-APDashboard.ps1 to work

PS C:\WINDOWS\system32> Copy-APDashboard -Name 'AppLens' -Session 'source' -TargetSession 'target'
Copy-APDashboard : [Copy-APDashboard]: Unable to locate a dashboard named [AppLens] in
[app-service-diagnostics-portal][app-service-diagnostics-portal]
At line:1 char:1

  • Copy-APDashboard -Name 'AppLens' -Session 'source' -TargetSession 'ta ...
  •   + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Copy-APDashboard
    
    

This dashboard is in the project. I have the right PATs for both and source with sufficient permissions. What am I missing here?

Install-APAgent /distributedTask/packages/agent endpoint moved?

Am currently trying to use Install-APAgent to install an agent and add to an existing pool, but get:

Install-APAgent : [Install-APAgent]: Unable to locate package url!

When I use the same parameters for other REST api calls, they work.

Trying to call (have obviously changed pat, collection, project from real data :) ):

$splat = @{
    Collection          = 'XXX'
    Project             = 'YYY'
    Instance            = 'https://dev.azure.com/'
    PersonalAccessToken = 'ecqxsvhakbhsezdy7t6zm3okvraasdasdura5dnwrkyn2lklt4u3a'
    ApiVersion          = 'vNext'
    SessionName         = 'mySession'
}

#https://dev.azure.com/xxx/yyy/_apis/distributedTask/packages/agent
$session = New-APSession @splat

Install-APAgent -PatAuthentication -apiversion $session.ApiVersion -PersonalAccessToken $session.PersonalAccessToken -DeploymentGroupName 'Dev' -DeploymentGroupTag 'myTag' -Collection $session.Collection -Project $session.Project -Platform 'Windows' -Instance $session.Instance -Verbose

When I try the same in postman, using a working collection using the same PAT (ie how I currently get release / build lists) I hit a redirect:
image

PARAMETER PropertyFilters seems to be not working

Hello @Dejulia489 !

Could you pls shed some light on Get-APReleaseDefinition.ps1 usage?

I've trying to retrive approvers data, like you suggested here but getting almost same result as running cmdlet without -PropertyFilters key. The only difference is given on pic below
image
LHS: Get-APReleaseDefinition -Session 'Session' -DefinitionId 2
RHS: Get-APReleaseDefinition -Session 'Session' -DefinitionId 2 -PropertyFilters 'environments,_links'

Header for GET request is containing valid payload.

Are there docs/development somewhere else?

I installed the PS module, and got 4.0.25 even though 4.0.13 is the "latest" listed here on github.
The readme here has an example login process using a deprecated Version instead of ApiVersion. (and the example vNext is not a valid version)

The help for Get-APProjectList has an example with parameters that don't exist...

Get-APProjectList -Instance 'https://dev.azure.com' -Collection 'myCollection' -Project 'myFirstProject'

Get-APProjectList: A parameter cannot be found that matches parameter name 'Project'.

Is there a newer version of the docs somewhere else? It's kind of confusing!

Also, what's a collection? Is that what ADO calls an Organization?

Authentication failure when using in GitHub Action on Linux agent

I'm using this module as a step in a GitHub Action workflow.

      - name: Queue build
        env:
          AZURE_DEVOPS_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}
        shell: pwsh
        run: |
          Install-Module AzurePipelinesPS -Repository PSGallery -Force
          Import-Module AzurePipelinesPS

          $secureToken = ConvertTo-SecureString -String $env:AZURE_DEVOPS_TOKEN -AsPlainText

          Get-APBuildDefinition -Project MyProject -Collection MyCollection -PersonalAccessToken $secureToken -Instance 'https://dev.azure.com/' -ApiVersion '6.0' -DefinitionID 1 -Verbose

If the job that this step runs in has runs-on: ubuntu-latest, then the Get-APBuildDefinition fails (returns the standard html text saying you need to log in).

If I set runs-on: windows-latest then the call succeeds.

Not sure why a Linux runner would cause it to fail

Remove Functions return empty line

Remove functions return empty line, there should be no output from the remove functions unless there are actual results returned from the call.

WebCmdletWebResponseException when calling New-APPermissionReport

I am trying to generate a list of users that have permissions for a certain repository in an Azure DevOps project, following your tutorial on stack overflow.

After creating the session I run

New-APPermissionReport -Session 'mySession' -InputObject @{
	descriptors = @()
	reportName = 'permReport'
	resources = @(
		@{
		resourceId = 'myProject/myRepo'
		resourceName = 'myRepo'
		resourceType = 'repo'
		}
	)
}

which results in the following error:

In C:\Users\Martin\Documents\WindowsPowerShell\Modules\AzurePipelinesPS\4.0.20\AzurePipelinesPS.psm1:34473 Zeichen:16
+         return Invoke-RestMethod @authenticatedRestMethodSplat
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

As far as I can tell the session should be OK, as I can successfully run Get-APBuildList -Session 'mySession' for example.

Release definition list property expanding does not work

When executing Get-APReleaseDefinitionList with -Expand parameter, query string Expand=<property> is added, but according to doc the query key should have $ prefix. As a result, expected property is not in result.

Command:
Get-APReleaseDefinitionList -Session test -SearchText <search text> -Expand environments -Verbose

full query from verbose:

GET https://vsrm.dev.azure.com/<org>/<proj>/_apis/release/definitions?SearchText=<search text>&Expand=environments&api-version=5.0

but it should be:

GET https://vsrm.dev.azure.com/<org>/<proj>/_apis/release/definitions?SearchText=<search text>&$expand=environments&api-version=5.0

Doc: https://docs.microsoft.com/en-us/rest/api/azure/devops/release/definitions/list?view=azure-devops-rest-5.0

Would you accept a feature request/PR for adding a deployment pool?

I'm thinking of creating a function on my end that would use Add-APDeploymentGroup that behaves as easily as the Azure Devops UI for deployment groups. Specifically, when you create a new Deployment Group, it would:

  • automatically create a deployment pool with name: team project + '-' + deployment group name if it does not exist, with poolType = deployment and autoSize = true
  • take the pool id of that deployment pool and use it when creating the new deployment group

To accomplish this, I would need to utilize the following api in conjunction with Add-APDeploymentGroup function:

Would you be open to accepting a PR implementing only a subset of the parameters? For example, there's not enough information or example on how to utilize the properties parameter when getting agent pool, nor is there sufficient information on what properties are required in the request body when adding an agent pool. Under those circumstances, I would only implement them minimally to match the back end behavior when adding a deployment group from UI.

Thank you in advance.

Is there platform independent PS module build to top of this one?

We are planning migration from classic pipelines to YAML pipelines and we know that on sometime in future we will most probably migrate to GitHub Enterprise too so I ended up thinking that it would make sense to create PS module where commands are same no matter what is underlying platform (PSGit on examples below).

I mean on way that would just login to Azure DevOps with command like:

$splat = @{
    Platform            = "AzureDevOps"
    GitRepo             = 'myRepo'
    Collection          = 'myCollection'
    Project             = 'myProject'
    Instance            = 'https://dev.azure.com/'
    PersonalAccessToken = 'myPersonalAccessToken'
}
New-PSGitSession @splat

and PSGit module would then use AzurePipelinesPS.

Or alternatively I would be able to login to GitHub Enterprise with command like:

$splat = @{
    Platform            = "GitHub"
    GitRepo             = 'myRepo'
    PersonalAccessToken = 'myPersonalAccessToken'
    Instance            = "github.contoso.com"
}
New-PSGitSession @splat

and PSGit module would then use PowerShellForGitHub.

But on both cases user would be able to use commands like:

New-PSGitPullRequest -SourceBranch "feat/new-ui" -TargetBranch "main" -Title "New UI"

and that it should be open source tool where community can add support for more platforms too.

@Dejulia489 I can see that you have earlier worked on with JiraPS. Are you aware of any tools like this?

Also asked same question from microsoft/PowerShellForGitHub#340

Update-APReleaseEnvironment broken for on-prem installs

Client: PowerShell 5.1 on Win10 1809
Server: Azure DevOps Server 2019 RC1 (on-prem)
API Versions: 4.1-preview.5, 5.1-preview.6

Issue is caused due to Azure DevOps Services (hosted) prepending the URL with vsrm. On-prem installs don't have the same subdomain prepended, it's still just the standard URL scheme for this endpoint in on-prem installs:

$Instance/$Collection/$Project/_apis/Release/releases/$ReleaseId/environments/$($EnvironmentId)?api-version=$APIVersion

Screenshot of the error:

image

PR coming up with the fix asap, already validated it by using the REST API directly ๐Ÿ˜„

Does New-APSession support a managed identity to connect to Azure DevOps?

Now that DevOps support managed identities I would like to use that to automate some tasks rather than using a PAT.

Previously I used this code to connect from an Azure PowerShell function app:

$splat = @{
Collection = 'xxxxxxxxxxxxx'
Project = 'Management%20Infrastructure'
Instance = 'https://dev.azure.com/'
ApiVersion = '7.1-preview'
SessionName = 'mySession'
PersonalAccessToken = $env:PAT
}
$session = New-APSession @Splat

I hoped the script would work like this but I'm getting Authentication issues. In a separate funtion I can use the same identity to authN to Azure resources.

$splat = @{
Collection = 'xxxxxxxxxxxx'
Project = 'Management%20Infrastructure'
Instance = 'https://dev.azure.com/'
ApiVersion = '7.1-preview'
SessionName = 'mySession'
}
$session = New-APSession @Splat

I hope you can point me in the right direction.

Regards,
BertusV

Update-APBuildDefinition DefinitionExistsException error

Hay there not sure what the issue could be but when I run the Update-APBuidDefinition I get the following
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Build pipeline PIPELINE_NAME already exists for project
PROJECT_NAME","typeName":"Microsoft.TeamFoundation.Build.WebApi.DefinitionExistsException,
Microsoft.TeamFoundation.Build2.WebApi","typeKey":"DefinitionExistsException","errorCode":0,"eventId":3000}
At C:\Program Files\WindowsPowerShell\Modules\AzurePipelinesPS\3.1.39\AzurePipelinesPS.psm1:28597 char:20

  •     $results = Invoke-RestMethod @authenticatedRestMethodSplat
    
  •                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

IF I change the name of the pipeline it creates a new one with all the past builds from the original one

Any reason or anything I might be missing

New-APEnvironmentApproval uses incorrect url

Thanks for the awesome lib!

Seems like New-APEnvironmentApproval uses wrong url when configuring approvals.

Currently it's _apis/pipelines/checks/configurations, but judging from DevOps UI network requests it should be <PROJECT_GUID>/_apis/pipelines/checks/configurations

Current error when trying to add approvers to the environment:

$results = Invoke-RestMethod @authenticatedRestMethodSplat
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |          Page not found.     html {     height: 100%; }  body {     font-family: "-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica
      | Neue", Helvetica, Ubuntu, Arial, sans-serif, "Apple Color Emoji",         "Segoe UI Emoji", "Segoe UI Symbol";     font-size: 14px;     height:
      | 100%;     margin: 0;     background-color: #fff; }  .container {     height: 100%;     display: flex;     flex-grow: 1;     flex-direction: column;
      | }  .header {     font-size: 14px;     line-height: 20px;     padding-right: 40px;     display: flex;     box-shadow: 0px 1px 0px rgba(0, 0, 0,
      | 0.08); }  .header > div, .header > a {     margin: 14px 0px 14px 32px;     text-decoration: none;     color: rgba(0, 0, 0, 0.55); }  .header >
      | div:first-child {     flex-grow: 1;     margin-left: 14px;     color: #0078d4;     display: flex; }  .header > div:first-child > div {
      | margin-left: 14px; }  .content-container {     display: flex;     flex-direction: column;     justify-content: center;     margin-top: 126px; }

Would be grateful for some workaround :-)

APPDATA is not defined on MacOS

Hi - in the Get-APSession method there is a reference to APPDATA. On MacOS this is not defined and Test-Path then fails. I could make this work by adding the following to my environment:
export APPDATA="/Users/myname/"
Perhaps you could test for this environment variable and if it doesn't exist then test for a HOME path?

Otherwise thank you so much - this is an awesome piece of work that has made my life so much easier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.