Skip to content
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

Add Description for Azure RMService Connection #516

Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 7.11.0

Merged [Pull Request](https://github.com/MethodsAndPractices/vsteam/pull/516) from [Arturo Polanco](https://github.com/arturopolanco) the following:
- Added option to add a description to the Azure RM Service Connecstions.

## 7.10.0

Merged [Pull Request](https://github.com/MethodsAndPractices/vsteam/pull/486) from [Sebastian Schütze](https://github.com/SebastianSchuetze) the following:
Expand Down
4 changes: 3 additions & 1 deletion Source/Public/Add-VSTeamAzureRMServiceEndpoint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Add-VSTeamAzureRMServiceEndpoint {
[string] $servicePrincipalKey,

[string] $endpointName,
[string] $Description,

[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[vsteam_lib.ProjectValidateAttribute($false)]
Expand Down Expand Up @@ -61,11 +62,12 @@ function Add-VSTeamAzureRMServiceEndpoint {
creationMode = $creationMode
}
url = 'https://management.azure.com/'
description = $Description
}

return Add-VSTeamServiceEndpoint -ProjectName $ProjectName `
-endpointName $endpointName `
-endpointType azurerm `
-object $obj
}
}
}
2 changes: 1 addition & 1 deletion Source/VSTeam.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'VSTeam.psm1'

# Version number of this module.
ModuleVersion = '7.10.0'
ModuleVersion = '7.11.0'

# Supported PSEditions
CompatiblePSEditions = @('Core', 'Desktop')
Expand Down
36 changes: 36 additions & 0 deletions Tests/function/tests/Add-VSTeamAzureRMServiceEndpoint.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Set-StrictMode -Version Latest

Describe 'Add-VSTeamAzureRMServiceEndpoint' {
BeforeAll {
. "$PSScriptRoot\_testInitialize.ps1" $PSCommandPath
. "$baseFolder/Source/Public/Add-VSTeamServiceEndpoint.ps1"
. "$baseFolder/Source/Public/Get-VSTeamServiceEndpoint.ps1"
}

Context 'Add-VSTeamAzureRMServiceEndpoint' {
BeforeAll {
Mock _getInstance { return 'https://dev.azure.com/test' }
Mock _getApiVersion { return '1.0-unitTests' } -ParameterFilter { $Service -eq 'ServiceEndpoints' }

Mock Write-Progress
Mock Invoke-RestMethod { _trackProcess }
Mock Invoke-RestMethod { return @{id = '23233-2342' } } -ParameterFilter { $Method -eq 'Post' }
}

It 'should create a new Azure RM Serviceendpoint' {
Add-VSTeamAzureRMServiceEndpoint -projectName 'projectName'`
-SubscriptionName 'SubscriptionName' `
-SubscriptionId 'SubscriptionId' `
-SubscriptionTenantId '00000000-0000-0000-0000-000000000000' `
-ServicePrincipalId '00000000-0000-0000-0000-000000000000' `
-ServicePrincipalKey 'clientsecret' `
-EndpointName 'AzureRMTest' `
-Description 'description here'

# On PowerShell 5 the JSON has two spaces but on PowerShell 6 it only has one so
# test for both.
Should -Invoke Invoke-RestMethod -Exactly -Scope It -Times 1 -ParameterFilter {
$Method -eq 'Post' }
}
}
}
5 changes: 4 additions & 1 deletion Tests/function/tests/Add-VSTeamKubernetesEndpoint.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ Describe 'VSTeamKubernetesEndpoint' {
BeforeAll {
Mock _getInstance { return 'https://dev.azure.com/test' }
Mock _getApiVersion { return '1.0-unitTests' } -ParameterFilter { $Service -eq 'ServiceEndpoints' }

Mock Set-VSTeamAccount -ModuleName $moduleName { return $null }
Mock Set-VSTeamDefaultProject -ModuleName $moduleName { return $null }
Mock Get-VSTeamProject -ModuleName $moduleName { return @{
Id = "2c01ff81-274b-4831-b001-c894cfb795bb" }}
Mock Write-Progress
Mock Invoke-RestMethod { _trackProcess }
Mock Invoke-RestMethod { return @{id = '23233-2342' } } -ParameterFilter { $Method -eq 'Post' }
Expand Down