File tree Expand file tree Collapse file tree 3 files changed +342
-461
lines changed
src/Resources/Resources.Test
SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ActiveDirectoryTests Expand file tree Collapse file tree 3 files changed +342
-461
lines changed Original file line number Diff line number Diff line change @@ -613,7 +613,25 @@ public void TestCreateDeleteAppCredentials()
613
613
[ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
614
614
public void TestCreateDeleteSpCredentials ( )
615
615
{
616
- TestRunner . RunTestScript ( "Test-CreateDeleteSpCredentials" ) ;
616
+ const string scriptMethod = "Test-CreateDeleteSpCredentials '{0}'" ;
617
+ Application application = null ;
618
+ var controllerAdmin = ResourcesController . NewInstance ;
619
+
620
+ controllerAdmin . RunPsTestWorkflow (
621
+ interceptor ,
622
+ // scriptBuilder
623
+ ( ) =>
624
+ {
625
+ application = CreateNewAdApp ( controllerAdmin ) ;
626
+ return new [ ] { string . Format ( scriptMethod , application . AppId ) } ;
627
+ } ,
628
+ // cleanup
629
+ ( ) =>
630
+ {
631
+ DeleteAdApp ( controllerAdmin , application ) ;
632
+ } ,
633
+ MethodBase . GetCurrentMethod ( ) . ReflectedType ? . ToString ( ) ,
634
+ MethodBase . GetCurrentMethod ( ) . Name ) ;
617
635
}
618
636
619
637
[ Fact ]
Original file line number Diff line number Diff line change @@ -762,6 +762,8 @@ Tests Creating and deleting application using Service Principal Credentials.
762
762
#>
763
763
function Test-CreateDeleteSpCredentials
764
764
{
765
+ param ([string ]$applicationId )
766
+
765
767
# Setup
766
768
$getAssetName = ConvertTo-SecureString " test" - AsPlainText - Force
767
769
$displayName = " test"
@@ -772,7 +774,7 @@ function Test-CreateDeleteSpCredentials
772
774
$keyId3 = " 4141b479-4ca0-4919-8451-7e155de6aa0f"
773
775
774
776
# Test - Add SP
775
- $servicePrincipal = New-AzADServicePrincipal - DisplayName $displayName
777
+ $servicePrincipal = New-AzADServicePrincipal - DisplayName $displayName - ApplicationId $applicationId
776
778
777
779
# Assert
778
780
Assert-NotNull $servicePrincipal
@@ -853,9 +855,5 @@ function Test-CreateDeleteSpCredentials
853
855
{
854
856
# Remove Service Principal
855
857
Remove-AzADServicePrincipal - ObjectId $servicePrincipal.Id - Force
856
-
857
- # Remove App
858
- $app = Get-AzADApplication - ApplicationId $servicePrincipal.ApplicationId
859
- Remove-AzADApplication - ObjectId $app.ObjectId - Force
860
858
}
861
859
}
You can’t perform that action at this time.
0 commit comments