├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── custom.md │ └── feature_request.md ├── .vscode └── settings.json ├── 100-blank-script ├── README.md └── run.ps1 ├── 101-azd-useBearerToken ├── README.md ├── images │ ├── accessOAuthToken.png │ ├── inlineScript.png │ └── powershellTask.png └── run.ps1 ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE └── README.md /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 19 | 20 | 21 | Steps to reproduce 22 | ------------------ 23 | 24 | ```PowerShell 25 | 26 | ``` 27 | 28 | Expected behavior 29 | ----------------- 30 | 31 | ```PowerShell 32 | none 33 | 34 | ``` 35 | 36 | Actual behavior 37 | --------------- 38 | 39 | ```PowerShell 40 | none 41 | ``` 42 | 43 | Environment data 44 | ---------------- 45 | 46 | OS 47 | 48 | - [ ] macOS 49 | - [ ] Windows 50 | - [ ] Linux 51 | 52 | Server 53 | 54 | - [ ] TFS 2017 55 | - [ ] TFS 2018 56 | - [ ] Azure DevOps Server 57 | - [ ] Azure DevOps Service 58 | 59 | 60 | 61 | ```PowerShell 62 | > Get-VSTeamAPIVersion 63 | ``` 64 | 65 | 66 | 67 | ```PowerShell 68 | > $PSVersionTable 69 | ``` 70 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "powershell.codeFormatting.addWhitespaceAroundPipe": true 3 | } -------------------------------------------------------------------------------- /100-blank-script/README.md: -------------------------------------------------------------------------------- 1 | # Blank Script 2 | 3 | `Tags: empty, blank` 4 | -------------------------------------------------------------------------------- /100-blank-script/run.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param() 3 | -------------------------------------------------------------------------------- /101-azd-useBearerToken/README.md: -------------------------------------------------------------------------------- 1 | # Using BearerToken Authentication 2 | 3 | When using [Azure DevOps](https://docs.microsoft.com/azure/devops/?view=azure-devops&WT.mc_id=repo-github-dbrown) you can use the BearerToken form of authentication with VSTeam. 4 | 5 | ## YAML Build 6 | 7 | For YAML builds the PowerShell task will work without having to enable OAuth token access. 8 | 9 | ```yml 10 | - task: PowerShell@2 11 | inputs: 12 | targetType: 'inline' 13 | script: | 14 | Install-Module VSTeam -Scope CurrentUser -Force 15 | Set-VSTeamAccount -Account $(System.CollectionUri) -Token $(System.AccessToken) -UseBearerToken 16 | Get-VSTeamInfo 17 | Get-VSTeamProject 18 | ``` 19 | 20 | ## Classic Editor 21 | 22 | You first must enable access to the OAuth token on the Agent Job. 23 | 24 | ![Access OAuth Token](images/accessOAuthToken.png "Access OAuth Token") 25 | 26 | Then you can add a PowerShell task to your build. 27 | 28 | ![PowerShell Task](images/powershellTask.png "PowerShell Task") 29 | 30 | Now simply copy and paste the code into the task using the **Inline** option. 31 | 32 | ![PowerShell Task](images/inlineScript.png "Inline script") 33 | 34 | ## Notes 35 | 36 | The BearerToken is scoped to the project executing the script. To access other instances you must use a [Personal Access Token](https://docs.microsoft.com/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page&WT.mc_id=repo-github-dbrown). 37 | 38 | Tags: `AzureDevOps, BearerToken, AzurePipelines` 39 | -------------------------------------------------------------------------------- /101-azd-useBearerToken/images/accessOAuthToken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MethodsAndPractices/vsteam-quickstart-scripts/d6b009c024e61c895e045cd4c25bd13cd6127aa8/101-azd-useBearerToken/images/accessOAuthToken.png -------------------------------------------------------------------------------- /101-azd-useBearerToken/images/inlineScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MethodsAndPractices/vsteam-quickstart-scripts/d6b009c024e61c895e045cd4c25bd13cd6127aa8/101-azd-useBearerToken/images/inlineScript.png -------------------------------------------------------------------------------- /101-azd-useBearerToken/images/powershellTask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MethodsAndPractices/vsteam-quickstart-scripts/d6b009c024e61c895e045cd4c25bd13cd6127aa8/101-azd-useBearerToken/images/powershellTask.png -------------------------------------------------------------------------------- /101-azd-useBearerToken/run.ps1: -------------------------------------------------------------------------------- 1 | # you can copy and paste this code into your Azure Pipeline build 2 | # make sure and enable OAuth token access for the Classic Editor 3 | Install-Module VSTeam -Scope CurrentUser -Force 4 | Set-VSTeamAccount -Account $(System.CollectionUri) -Token $(System.AccessToken) -UseBearerToken 5 | Get-VSTeamInfo 6 | Get-VSTeamProject -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at dbrown@microsoft.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to VSTeam Quickstart Scripts 2 | 3 | I am truly grateful for all the support developing VSTeam Quickstart Scripts. It means a lot that you spend your time to help improve this collection of scripts for the community. This repo contains all currently available VSTeam scripts contributed by the community. 4 | 5 | The following information is relevant to get started with contributing to this repository. 6 | 7 | + [**Contribution guide**](/1-CONTRIBUTION-GUIDE/README.md#contribution-guide). Describes the minimal guidelines for contributing. 8 | + [**Best practices**](/1-CONTRIBUTION-GUIDE/best-practices.md#best-practices). Best practices for improving the quality of your script design. 9 | + [**Git tutorial**](/1-CONTRIBUTION-GUIDE/git-tutorial.md#git-tutorial). Step by step to get you started with Git. 10 | + [**Useful Tools**](/1-CONTRIBUTION-GUIDE/useful-tools.md#useful-tools). Useful resources and tools for Azure development. 11 | 12 | ## Steps to contribute 13 | 14 | 1. Create a folder for your script 15 | 2. Create a Readme.md that describes how to use the script 16 | 3. Develop script and commit changes. 17 | 18 | ### Housekeeping 19 | 20 | The VSTeam module runs on macOS, Windows and Linux. Therefore, **casing is very important**. If your script only works on one platform please describe in the Readme.md file. Also note if this only support a specific version of TFS or requires a minimum API version. 21 | 22 | ## Contribution Guide 23 | 24 | To make sure your scripts are easy to use, please follow these guidelines. 25 | 26 | ## Files, folders and naming conventions 27 | 28 | 1. Every script and its associated files must be contained in its own **folder**. Name this folder something that describes what your script does. Usually this naming pattern looks like **level-resource-action** (e.g. 101-git-stale-branches) 29 | 30 | + **Required** - Numbering should start at 101. 100 is reserved for things that need to be at the top. 31 | + **Protip** - Try to keep the name of your script folder short so that it fits inside the GitHub folder name column width. 32 | 33 | 1. GitHub uses ASCII for ordering files and folder. For consistent ordering **create all files and folders in lowercase**. The only **exception** to this guideline is the **README.md**, that should be in the format **UPPERCASE.lowercase**. 34 | 35 | 1. Include a **README.md** file that explains how the script works. 36 | 37 | + Guidelines on the README.md file below. 38 | 39 | 1. The script file must be named **run.ps1**. 40 | 41 | + Use default values for parameters in the script whenever there is a value that will work for all users. Decorate parameter with `ValidateSet` whenever possible. 42 | 43 | ```powershell 44 | [ValidateSet('Get', 'Post', 'Patch', 'Delete', 'Options', 'Put', 'Default', 'Head', 'Merge', 'Trace')] 45 | [string] $Method, 46 | ``` 47 | 48 | 1. Referenced scripts must be placed in a folder called **nested**. 49 | 1. Images used in the README.md must be placed in a folder called **images**. 50 | 51 | ```powershell 52 | Mode Name 53 | ---- ---- 54 | d---- images 55 | d---- nested 56 | -a--- README.md 57 | -a--- run.ps1 58 | ``` 59 | 60 | ## README.md 61 | 62 | The README.md describes your script. A good description helps other community members to understand your script. The README.md uses [GitHub Flavored Markdown](https://guides.GitHub.com/features/mastering-markdown/) for formatting text. If you want to add images to your README.md file, store the images in the **images** folder. Reference the images in the README.md with a relative path (e.g. `![alt text](images/powershellTask.png "Azure DevOps Power Task")`). This ensures the link will reference the target repository if the source repository is forked. A good README.md contains the following sections 63 | 64 | + Description of what the script does 65 | + Tags, that can be used for search. Specify the tags comma separated and enclosed between two back-ticks (e.g Tags: `AzureDevOps, BearerToken, AzurePipelines`) 66 | + *Optional: Prerequisites 67 | + *Optional: Notes 68 | 69 | ## Azure DevOps CI 70 | 71 | We have automated script validation through Azure DevOps CI. These builds can be accessed by clicking the 'Details' link at the bottom of the pull-request dialog. This process will ensure that your script conforms to all the rules mentioned above. 72 | 73 | This project has a [Code of Conduct](CODE_OF_CONDUCT.md). -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Methods and Practices 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VSTeam Quickstart Scripts 2 | 3 | VSTeam Quickstart Scripts 4 | 5 | This repo contains all currently available VSTeam scripts contributed by the community. 6 | 7 | See the [**Contribution guide**](/CONTRIBUTING.md#contribution-guide) for how to use or contribute to this repo. 8 | The code is under the [MIT License](LICENSE) as well as under the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md) 9 | --------------------------------------------------------------------------------