@@ -5,39 +5,40 @@ Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing Con
5
5
$appName = New-LiveTestResourceName
6
6
$workspaceName = New-LiveTestResourceName
7
7
$envName = New-LiveTestResourceName
8
- $headerName = New-LiveTestResourceName
9
- $secretName = New-LiveTestResourceName
10
8
$appLocation = " westus"
9
+
11
10
$null = New-AzOperationalInsightsWorkspace - ResourceGroupName $rgName - Name $workspaceName - Sku PerGB2018 - Location $appLocation - PublicNetworkAccessForIngestion " Enabled" - PublicNetworkAccessForQuery " Enabled"
12
11
$CustomId = (Get-AzOperationalInsightsWorkspace - ResourceGroupName $rgName - Name $workspaceName ).CustomerId
13
12
$SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey - ResourceGroupName $rgName - Name $workspaceName ).PrimarySharedKey
14
- $null = New-AzContainerAppManagedEnv - EnvName $envName - ResourceGroupName $rgName - Location $appLocation - AppLogConfigurationDestination " log-analytics" - LogAnalyticConfigurationCustomerId $CustomId - LogAnalyticConfigurationSharedKey $SharedKey - VnetConfigurationInternal:$false
15
- $trafficWeight = New-AzContainerAppTrafficWeightObject - Label production - LatestRevision $True - Weight 100
16
- $secretObject = New-AzContainerAppSecretObject - Name $secretName - Value " facebook-password"
17
- $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject - Name $headerName - Value Awesome
18
- $probe = New-AzContainerAppProbeObject - HttpGetPath " /health" - HttpGetPort 8080 - InitialDelaySecond 3 - PeriodSecond 3 - Type Liveness - HttpGetHttpHeader $containerAppHttpHeader
19
- $image = New-AzContainerAppTemplateObject - Name $appName - Image mcr.microsoft.com / azuredocs/ containerapps- helloworld:latest - Probe $probe - ResourceCpu 2.0 - ResourceMemory 4. 0Gi
13
+ $workloadProfile = New-AzContainerAppWorkloadProfileObject - Name " Consumption" - Type " Consumption"
14
+ $null = New-AzContainerAppManagedEnv - EnvName $envName - ResourceGroupName $rgName - Location $appLocation - AppLogConfigurationDestination " log-analytics" - LogAnalyticConfigurationCustomerId $CustomId - LogAnalyticConfigurationSharedKey $SharedKey - VnetConfigurationInternal:$false - WorkloadProfile $workloadProfile
20
15
$EnvId = (Get-AzContainerAppManagedEnv - ResourceGroupName $rgName - EnvName $envName ).Id
21
- $scaleRule = @ ()
16
+ $secretObject = New-AzContainerAppSecretObject - Name " redis-config" - Value " redis-password"
17
+ $probeHttpGetHttpHeader = New-AzContainerAppProbeHeaderObject - Name " Custom-Header" - Value " Awesome"
18
+ $probe = New-AzContainerAppProbeObject - HttpGetPath " /health" - HttpGetPort 8080 - InitialDelaySecond 3 - PeriodSecond 3 - Type Liveness - HttpGetHttpHeader $probeHttpGetHttpHeader
19
+ $temp = New-AzContainerAppTemplateObject - Name $appName - Image " mcr.microsoft.com/k8se/quickstart-jobs:latest" - Probe $probe - ResourceCpu 0.25 - ResourceMemory " 0.5Gi"
20
+ $configuration = New-AzContainerAppConfigurationObject - DaprEnabled:$True - DaprAppPort 3000 - DaprAppProtocol " http" - DaprHttpReadBufferSize 30 - DaprHttpMaxRequestSize 10 - DaprLogLevel " debug" - DaprEnableApiLogging:$True - MaxInactiveRevision 10 - ServiceType " redis" - Secret $secretObject
21
+
22
22
# Test creating AzContainerApp
23
- $actual = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - ConfigurationActiveRevisionsMode ' Single ' - ManagedEnvironmentId $EnvId - IngressExternal - IngressTransport ' auto ' - IngressTargetPort 80 - TemplateContainer $image - ConfigurationSecret $secretObject - IngressTraffic $trafficWeight - DaprEnabled - DaprAppProtocol ' http ' - DaprAppId " container-app-1 " - DaprAppPort 8080 - ScaleRule $scaleRule
23
+ $actual = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - Configuration $configuration - TemplateContainer $temp - EnvironmentId $EnvId
24
24
Assert-AreEqual $appName $actual.Name
25
- Assert-AreEqual 8080 $actual.DaprAppPort
25
+ Assert-AreEqual $actual.ProvisioningState " Succeeded "
26
26
# Test listing ContainerApp
27
- $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - ConfigurationActiveRevisionsMode ' Single ' - ManagedEnvironmentId $EnvId - IngressExternal - IngressTransport ' auto ' - IngressTargetPort 80 - TemplateContainer $image - ConfigurationSecret $secretObject - IngressTraffic $trafficWeight - DaprEnabled - DaprAppProtocol ' http ' - DaprAppId " container-app-1 " - DaprAppPort 8080 - ScaleRule $scaleRule
27
+ $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - Configuration $configuration - TemplateContainer $temp - EnvironmentId $EnvId
28
28
$actual = Get-AzContainerApp - ResourceGroupName $rgName
29
29
Assert-True { $actual.Count -ge 1 }
30
30
# Test getting one ContainerApp
31
- $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - ConfigurationActiveRevisionsMode ' Single ' - ManagedEnvironmentId $EnvId - IngressExternal - IngressTransport ' auto ' - IngressTargetPort 80 - TemplateContainer $image - ConfigurationSecret $secretObject - IngressTraffic $trafficWeight - DaprEnabled - DaprAppProtocol ' http ' - DaprAppId " container-app-1 " - DaprAppPort 8080 - ScaleRule $scaleRule
31
+ $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - Configuration $configuration - TemplateContainer $temp - EnvironmentId $EnvId
32
32
$actual = Get-AzContainerApp - ResourceGroupName $rgName - Name $appName
33
33
Assert-AreEqual $appName $actual.Name
34
34
# Test Updating one specific ContainerApp
35
- $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - ConfigurationActiveRevisionsMode ' Single ' - ManagedEnvironmentId $EnvId - IngressExternal - IngressTransport ' auto ' - IngressTargetPort 80 - TemplateContainer $image - ConfigurationSecret $secretObject - IngressTraffic $trafficWeight - DaprEnabled - DaprAppProtocol ' http ' - DaprAppId " container-app-1 " - DaprAppPort 8080 - ScaleRule $scaleRule
36
- $null = Update-AzContainerApp - Name $appName - ResourceGroupName $rgName - DaprAppPort 8888 - Location $appLocation
35
+ $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - Configuration $configuration - TemplateContainer $temp - EnvironmentId $EnvId
36
+ $null = Update-AzContainerApp - Name $appName - ResourceGroupName $rgName - Configuration $configuration - Tag @ { " 123 " = " abc " }
37
37
$actual = Get-AzContainerApp - ResourceGroupName $rgName - Name $appName
38
- Assert-AreEqual $actual.DaprAppPort 8888
38
+ Assert-AreEqual $actual.Tag.Count 1
39
+ Assert-AreEqual $actual.Tag [" 123" ] " abc"
39
40
# Test Removing ContainerApp
40
- $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - ConfigurationActiveRevisionsMode ' Single ' - ManagedEnvironmentId $EnvId - IngressExternal - IngressTransport ' auto ' - IngressTargetPort 80 - TemplateContainer $image - ConfigurationSecret $secretObject - IngressTraffic $trafficWeight - DaprEnabled - DaprAppProtocol ' http ' - DaprAppId " container-app-1 " - DaprAppPort 8080 - ScaleRule $scaleRule
41
+ $null = New-AzContainerApp - Name $appName - ResourceGroupName $rgName - Location $appLocation - Configuration $configuration - TemplateContainer $temp - EnvironmentId $EnvId
41
42
$null = Remove-AzContainerApp - ResourceGroupName $rgName - Name $appName
42
43
$GetServiceList = Get-AzContainerApp - ResourceGroupName $rgName
43
44
Assert-False { $GetServiceList.Name -contains $appName }
0 commit comments