-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Adding Web App Ssl binding cmdlets and renaming existing Web App cmdlet names to use 'Rm' instead of 'RM' #1561
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
71a3190
Adding web app certificate cmdlets
akurmi d895dcc
Updating nuget library 'Microsoft.Azure.Management.Websites' to v1.0.…
akurmi 4c87712
Upgrading Microsoft.Rest.ClientRuntime to v1.8.0
akurmi e17021a
Adding app.config with assemblyBinding node for Newtonsoft.Json
akurmi b3d2119
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
akurmi a885710
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
akurmi 50b4ee5
Merge remote-tracking branch 'upstream/dev' into dev
akurmi d2d0250
Restoring .csproj and .packages files
akurmi 515392b
Renaming Web App cmdlets to use 'Rm' instead of 'RM' and fixing Web A…
akurmi e407413
Merge remote-tracking branch 'upstream/dev' into dev
akurmi 29d780a
Adding 'Copy If Newer' flag for test json files to fix test failures
akurmi 90088ba
Merge remote-tracking branch 'upstream/dev' into dev
akurmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/SSLBindingTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // Copyright Microsoft Corporation | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // ---------------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
| using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests | ||
| { | ||
| public class SSLBindingTests : RMTestBase | ||
| { | ||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestCreateNewWebAppSSLBinding() | ||
| { | ||
| WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppSSLBinding"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestGetNewWebAppSSLBinding() | ||
| { | ||
| WebsitesController.NewInstance.RunPsTest("Test-GetNewWebAppSSLBinding"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestRemoveNewWebAppSSLBinding() | ||
| { | ||
| WebsitesController.NewInstance.RunPsTest("Test-RemoveNewWebAppSSLBinding"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestWebAppSSLBindingPipeSupport() | ||
| { | ||
| WebsitesController.NewInstance.RunPsTest("Test-WebAppSSLBindingPipeSupport"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestGetWebAppCertificate() | ||
| { | ||
| WebsitesController.NewInstance.RunPsTest("Test-GetWebAppCertificate"); | ||
| } | ||
| } | ||
| } |
189 changes: 189 additions & 0 deletions
189
src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/SSLBindingTests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| # ---------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright Microsoft Corporation | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ---------------------------------------------------------------------------------- | ||
|
|
||
| <# If you want to run these tests live then create a Basic/Standard/Premium web app, | ||
| assign a custom domain to it and update global variable values. | ||
| #> | ||
|
|
||
| #Global variables | ||
| $rgname = "webappsslbindingrb" | ||
| $appname = "webappsslbindingtest" | ||
| $slot = "testslot" | ||
| $prodHostname = "www.webappsslbindingtests.com" | ||
| $slotHostname = "testslot.webappsslbindingtests.com" | ||
| $thumbprint = "40D6600B0B8740C41BA4B3D13B967DDEF6ED1918" | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests creating a new Web App SSL binding. | ||
| #> | ||
| function Test-CreateNewWebAppSSLBinding | ||
| { | ||
| try | ||
| { | ||
| # Test - Create Ssl binding for web app | ||
| $createResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint | ||
| Assert-AreEqual $prodHostname $createResult.Name | ||
|
|
||
| # Test - Create Ssl binding for web app slot | ||
| $createResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Thumbprint $thumbprint | ||
| Assert-AreEqual $slotHostname $createResult.Name | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests retrieving Web App SSL binding. | ||
| #> | ||
| function Test-GetNewWebAppSSLBinding | ||
| { | ||
| try | ||
| { | ||
| # Setup - Create Ssl bindings | ||
| $createWebAppResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint | ||
| $createWebAppSlotResult = New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Thumbprint $thumbprint | ||
|
|
||
| # Test - Get commands for web app | ||
| $getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname | ||
| Assert-AreEqual 2 $getResult.Count | ||
| $currentHostNames = $getResult | Select -expand Name | ||
| Assert-True { $currentHostNames -contains $createWebAppResult.Name } | ||
| $getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname | ||
| Assert-AreEqual $getResult.Name $createWebAppResult.Name | ||
|
|
||
| # Test - Get commands for web app slot | ||
| $getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot | ||
| Assert-AreEqual 1 $getResult.Count | ||
| $currentHostNames = $getResult | Select -expand Name | ||
| Assert-True { $currentHostNames -contains $createWebAppSlotResult.Name } | ||
| $getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname | ||
| Assert-AreEqual $getResult.Name $createWebAppSlotResult.Name | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests removing Web App SSL binding. | ||
| #> | ||
| function Test-RemoveNewWebAppSSLBinding | ||
| { | ||
| try | ||
| { | ||
| # Setup - Create Ssl bindings | ||
| New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint | ||
| New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Thumbprint $thumbprint | ||
|
|
||
| # Tests - Removing binding from web app and web app slot | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force | ||
|
|
||
| # Assert | ||
| $res = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname | ||
| $currentHostNames = $res | Select -expand Name | ||
| Assert-False { $currentHostNames -contains $prodHostname } | ||
|
|
||
| $res = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot | ||
| $currentHostNames = $res | Select -expand Name | ||
| Assert-False { $currentHostNames -contains $slotHostName } | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Force | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostname -Force | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests executing Ssl binding cmdlets using pipe | ||
| #> | ||
| function Test-WebAppSSLBindingPipeSupport | ||
| { | ||
| try | ||
| { | ||
| # Setup - Retrieve web app and web app slot objects | ||
| $webapp = Get-AzureRMWebApp -ResourceGroupName $rgname -Name $appname | ||
| $webappslot = Get-AzureRMWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $slot | ||
|
|
||
| # Test - Create Ssl bindings using web app and web app slot objects | ||
| $createResult = $webapp | New-AzureRMWebAppSSLBinding -Name $prodHostName -Thumbprint $thumbprint | ||
| Assert-AreEqual $prodHostName $createResult.Name | ||
|
|
||
| $createResult = $webappslot | New-AzureRMWebAppSSLBinding -Name $slotHostName -Thumbprint $thumbprint | ||
| Assert-AreEqual $slotHostName $createResult.Name | ||
|
|
||
| # Test - Retrieve Ssl bindings using web app and web app slot objects | ||
| $getResult = $webapp | Get-AzureRMWebAppSSLBinding | ||
| Assert-AreEqual 2 $getResult.Count | ||
|
|
||
| $getResult = $webappslot | Get-AzureRMWebAppSSLBinding | ||
| Assert-AreEqual 1 $getResult.Count | ||
|
|
||
| # Test - Delete Ssl bindings using web app and web app slot objects | ||
| $webapp | Remove-AzureRMWebAppSSLBinding -Name $prodHostName -Force | ||
| $res = $webapp | Get-AzureRMWebAppSSLBinding | ||
| $currentHostNames = $res | Select -expand Name | ||
| Assert-False { $currentHostNames -contains $prodHostName } | ||
|
|
||
| $webappslot | Remove-AzureRMWebAppSSLBinding -Name $slotHostName -Force | ||
| $res = $webappslot | Get-AzureRMWebAppSSLBinding | ||
| $currentHostNames = $res | Select -expand Name | ||
| Assert-False { $currentHostNames -contains $slotHostName } | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostName -Force | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Slot $slot -Name $slotHostName -Force | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests retrieving web app certificates | ||
| #> | ||
| function Test-GetWebAppCertificate | ||
| { | ||
| try | ||
| { | ||
| # Setup - Create Ssl bindings | ||
| New-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname -Thumbprint $thumbprint | ||
|
|
||
| # Tests - Retrieve web app certificate objects | ||
| $certificates = Get-AzureRMWebAppCertificate | ||
| $thumbprints = $certificates | Select -expand Thumbprint | ||
| Assert-True { $thumbprints -contains $thumbprint } | ||
|
|
||
| $certificate = Get-AzureRMWebAppCertificate -Thumbprint $thumbprint | ||
| Assert-AreEqual $thumbprint $certificate.Thumbprint | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostName -Force | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akurmi These new recording files need to be copied to the output directory as well - in VS Properties/Copy If Newer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @markcowl for identifying the issue, I just checked-in a fix.