Skip to content

Commit 21954cb

Browse files
author
Hao Chen
committed
Change comlet from azure to az and enable ndx test for webapp slot
1 parent 812dabf commit 21954cb

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

examples/webapp-management/02-WebAppSlot.sh

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,37 @@ tier2="Premium"
2424
apiversion="2015-08-01"
2525
resourceType="Microsoft.Web/sites"
2626

27-
azure group create --name "$groupName" --location "$location"
27+
az group create --name "$groupName" --location "$location"
2828

2929
printf "\n1. Create a new app service plan %s " "$planName1"
30-
azure app service plan create -n "$planName1" -g "$groupName" -l "$location" --tier "$tier1"
30+
az app service plan create -n "$planName1" -g "$groupName" -l "$location" --tier "$tier1"
3131

3232
printf "\n2. Create a new web app %s " "$appName1"
33-
webappInfo1=`azure webapp create -g "$groupName" -n "$appName1" -l "$location" --plan "$planName1"`
33+
webappInfo1=`az webapp create -g "$groupName" -n "$appName1" -l "$location" --plan "$planName1"`
3434

3535
printf "\nValidating web app name %s " "$appName1"
3636
[ $(echo $webappInfo1 | jq '.name' --raw-output) == "$appName1" ]
3737

3838
printf "\n3. Create a web app slot %s " "$slotname1"
39-
slot1=`azure webapp slot create -g "$groupName" --plan "$planName1" -n "$appName1" --slot "$slotname1"`
39+
slot1=`az webapp slot create -g "$groupName" --plan "$planName1" -n "$appName1" --slot "$slotname1"`
4040
appWithSlotName1="$appName1/$slotname1"
4141

4242
printf "\nValidating web app slot %s " "$slotname1"
4343
[ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotName1" ]
4444

4545
printf "\nValidating web app slot get for %s " "$slotname1"
46-
slot1=`azure webapp slot get -g "$groupName" -n "$appName1" --slot "$slotname1"`
46+
slot1=`az webapp slot get -g "$groupName" -n "$appName1" --slot "$slotname1"`
4747
[ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotName1" ]
4848

4949
printf "\nValidating web app slot via pipline obj for %s " "$slotname1"
50-
slot1=`echo "$webappInfo1" | azure webapp slot get --slot "$slotname1"`
50+
slot1=`echo "$webappInfo1" | az webapp slot get --slot "$slotname1"`
5151

5252
printf "\n4. Create another web app slot %s " "$slotname2"
53-
slot2=`azure webapp slot create -g "$groupName" --plan "$planName1" -n "$appName1" --slot "$slotname2"`
53+
slot2=`az webapp slot create -g "$groupName" --plan "$planName1" -n "$appName1" --slot "$slotname2"`
5454
appWithSlotName2="$appName1/$slotname2"
5555

5656
printf "\n5. Get the webapp slots:"
57-
slots=`azure webapp slot get -g "$groupName" -n "$appName1"`
57+
slots=`az webapp slot get -g "$groupName" -n "$appName1"`
5858
slotN1=`echo $slots | jq '.[0].name'`
5959
slotN2=`echo $slots | jq '.[1].name'`
6060
slotNames=`echo $slotN1 $slotN2`
@@ -64,9 +64,9 @@ printf "\nValidating web app slots %s " "$slotname1 and $slotname2"
6464
[[ $slotNames == *"$appWithSlotName2"* ]]
6565

6666
printf "\n6. Change web app slot %s service plan" "$slotname2"
67-
servicePlanInfo2=`azure app service plan create -n "$planName2" -g "$groupName" -l "$location" --tier "$tier2"`
68-
# slot3=`azure webapp slot create -g "$groupName" --plan "$planName3" -n "$appName" --slot "$slotname2"`
69-
slot1=`azure webapp slot set -g "$groupName" -n "$appName1" --slot "$slotname1" --plan "$planName2"`
67+
servicePlanInfo2=`az app service plan create -n "$planName2" -g "$groupName" -l "$location" --tier "$tier2"`
68+
# slot3=`az webapp slot create -g "$groupName" --plan "$planName3" -n "$appName" --slot "$slotname2"`
69+
slot1=`az webapp slot set -g "$groupName" -n "$appName1" --slot "$slotname1" --plan "$planName2"`
7070

7171
printf "\nValidating web app slots %s " "$slotname1"
7272
[ $(echo $slot1 | jq '.name' --raw-output) == "$appName1/$slotname1" ]
@@ -78,16 +78,16 @@ printf "\n7. Set web app slot %s config properties"
7878
printf "\n8. Set web app slot settings and connection strings"
7979
appsettings="{\"setting1\":\"valueA\",\"setting2\":\"valueB\"}"
8080
connectionstrings="{ \"connstring1\": { \"Type\": \"MySql\", \"Value\": \"string value 1\" }, \"connstring2\": { \"Type\": \"SqlAzure\", \"Value\": \"string value 2\" } }"
81-
slot1=`azure webapp slot set -g "$groupName" --plan "$planName1" -n "$appName1" --slot "$slotname1" --connectionstrings "$connectionstrings" --appsettings "$appsettings"`
81+
slot1=`az webapp slot set -g "$groupName" --plan "$planName1" -n "$appName1" --slot "$slotname1" --connectionstrings "$connectionstrings" --appsettings "$appsettings"`
8282

8383
printf "\n9. Get web app slot %s publishing profile" "$slotname1"
8484
outputFile1="webappslot-profile-1"
8585
outputFile2="webappslot-profile-2"
86-
azure webapp slot profile get -g "$groupName" -n "$appName1" --slot "$slotname1" --outputfile "$outputFile1"
86+
az webapp slot profile get -g "$groupName" -n "$appName1" --slot "$slotname1" --outputfile "$outputFile1"
8787

8888
printf "\n10. Get web app slot %s publishing profile via pipline obj" "$slotname1"
8989
# Unable to test pipline. verity property name and value instead.
90-
# echo "$slot1" | azure webapp slot profile get --outputfile "$outputFile2"
90+
# echo "$slot1" | az webapp slot profile get --outputfile "$outputFile2"
9191

9292
printf "\nValidating web app slot profile output file"
9393
[ -s "$outputFile1" ]
@@ -102,82 +102,82 @@ done
102102
endTime=`date +"%A, %B %d, %Y %X"`
103103
startTime=`date +"%A, %B %d, %Y %X" --date "3 hour ago"`
104104
metricsNames="[\"CPU\",\"Request\"]"
105-
metrics=`azure webapp slot metrics get -g "$groupName" -n "$appName1" --slot "$slotname1" --granularity PT1M --starttime "$startTime" --endtime "$endTime" --metrics "$metricsNames"`
105+
metrics=`az webapp slot metrics get -g "$groupName" -n "$appName1" --slot "$slotname1" --granularity PT1M --starttime "$startTime" --endtime "$endTime" --metrics "$metricsNames"`
106106

107107
printf "\nValidating web app slot metrics via pipline obj %s " "$slotname1"
108108
# Unable to test pipline. verity property name and value instead.
109-
# echo "$slot1" | azure webapp slot metrics get --metrics "$metricsNames" --starttime "$startTime" --endtime "$endTime" --granularity PT1M
109+
# echo "$slot1" | az webapp slot metrics get --metrics "$metricsNames" --starttime "$startTime" --endtime "$endTime" --granularity PT1M
110110

111111
printf "\n12. Stop web app slot: %s." "$slotname1"
112-
slot1=`echo "$slot1" | azure webapp slot stop`
112+
slot1=`echo "$slot1" | az webapp slot stop`
113113
printf "\nValidating web app slot %s stopped " "$slotname1"
114114
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Stopped" ]
115115

116116
printf "\n13 Stop web app slot: %s." "$slotname1"
117-
slot1=`echo "$slot1" | azure webapp slot start`
117+
slot1=`echo "$slot1" | az webapp slot start`
118118
printf "\nValidating web app slot %s running " "$slotname1"
119119
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
120120

121121
printf "\n14 Stop web app slot: %s." "$slotname1"
122-
slot1=`echo "$slot1" | azure webapp slot stop`
122+
slot1=`echo "$slot1" | az webapp slot stop`
123123
printf "\nValidating web app slot %s stopped " "$slotname1"
124124
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Stopped" ]
125125

126126
printf "\n15 Stop web app slot: %s." "$slotname1"
127-
slot1=`echo "$slot1" | azure webapp slot start`
127+
slot1=`echo "$slot1" | az webapp slot start`
128128
printf "\nValidating web app slot %s running " "$slotname1"
129129
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
130130

131131
printf "\n16 Restart web app slot: %s." "$slotname1"
132-
slot1=`azure webapp slot restart -g "$groupName" -n "$appName1" --slot "$slotname1"`
132+
slot1=`az webapp slot restart -g "$groupName" -n "$appName1" --slot "$slotname1"`
133133
printf "\nValidating web app slot %s Running " "$slotname1"
134134
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
135135

136136
printf "\n17 Restart web app slot: %s with pipline object." "$slotname1"
137-
slot1=`echo "$slot1" | azure webapp slot restart`
137+
slot1=`echo "$slot1" | az webapp slot restart`
138138
printf "\nValidating web app slot %s Running " "$slotname1"
139139
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
140140

141141
# Need to create a 'Premium' plan for clone test
142142
printf "\n18. Create a new web app for clone testing"
143143
location1="eastus"
144144

145-
azure app service plan set -n "$planName1" -g "$groupName" --tier "$tier2"
146-
webappInfo2=`azure webapp create -g "$groupName" -n "$appName2" -l "$location" --plan "$planName2"`
145+
az app service plan set -n "$planName1" -g "$groupName" --tier "$tier2"
146+
webappInfo2=`az webapp create -g "$groupName" -n "$appName2" -l "$location" --plan "$planName2"`
147147

148148
printf "\n19. Clone web app slot to a slot."
149-
slotClone=`azure webapp slot create -g "$groupName" -n "$appName2" --slot "$slotname3" --sourcewebapp "$webappInfo2"`
149+
slotClone=`az webapp slot create -g "$groupName" -n "$appName2" --slot "$slotname3" --sourcewebapp "$webappInfo2"`
150150
appWithSlotNameClone="$appName2/$slotname3"
151151

152152
printf "\nValidating cloned web app slot %s " "$slotname3"
153153
[ $(echo $slotClone | jq '.name' --raw-output) == "$appWithSlotNameClone" ]
154154

155155
printf "\nValidating web app slot get for %s " "$slotname3"
156-
slotClone=`azure webapp slot get -g "$groupName" -n "$appName2" --slot "$slotname3"`
156+
slotClone=`az webapp slot get -g "$groupName" -n "$appName2" --slot "$slotname3"`
157157
[ $(echo $slotClone | jq '.name' --raw-output) == "$appWithSlotNameClone" ]
158158

159159
printf "\n20. Create a new web app for clone testing"
160-
slot2=`azure webapp slot create -g "$groupName" --plan "$planName2" -n "$appName2" --slot "$slotname3"`
160+
slot2=`az webapp slot create -g "$groupName" --plan "$planName2" -n "$appName2" --slot "$slotname3"`
161161
slotN1="$appName2/$slotname3"
162162

163163
printf "\n21. Create a new web app for clone testing"
164-
servicePlan=`azure app service plan create -n "$planName3" -g "$groupName" -l "$location1" --tier "$tier2"`
165-
webappInfo3=`azure webapp create -g "$groupName" -n "$appName3" -l "$location1" --plan "$planName3"`
166-
slot3=`azure webapp slot create -g "$groupName" -n "$appName3" --slot "$slotname3" --sourcewebapp "$webappInfo3"`
164+
servicePlan=`az app service plan create -n "$planName3" -g "$groupName" -l "$location1" --tier "$tier2"`
165+
webappInfo3=`az webapp create -g "$groupName" -n "$appName3" -l "$location1" --plan "$planName3"`
166+
slot3=`az webapp slot create -g "$groupName" -n "$appName3" --slot "$slotname3" --sourcewebapp "$webappInfo3"`
167167

168168
printf "\nValidating web app slot get for %s " "$slotname3"
169169
appWithSlotName3="$appName3/$slotname3"
170170
[ $(echo $slot3 | jq '.name' --raw-output) == "$appWithSlotName3" ]
171171

172172
# Cleanup
173173
printf "\n22. Remove web app slot: %s." "$slotname1"
174-
azure webapp slot remove -g "$groupName" -n "$appName1" --slot "$slotname1" --force
174+
az webapp slot remove -g "$groupName" -n "$appName1" --slot "$slotname1" --force
175175

176176
printf "\n23. Remove web app: %s." "$appName1"
177-
azure webapp remove -g "$groupName" -n "$appName1" --force
177+
az webapp remove -g "$groupName" -n "$appName1" --force
178178

179179
printf "\n24. Remove app service plan: %s." "$planName1"
180-
azure app service plan remove -g "$groupName" -n "$planName1" --force
180+
az app service plan remove -g "$groupName" -n "$planName1" --force
181181

182182
printf "\n25. Remove resource group: %s." "$groupName"
183-
azure group remove --name "$groupName" --force
183+
az group remove --name "$groupName" --force

src/CLU/Commands.Common.ScenarioTest/ExamplesTests/WebsitesTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void AppServicePlanTest()
3232
helper.RunScript("01-AppServicePlan");
3333
}
3434

35-
[Fact(Skip = "TODO: Work in progress")]
35+
[Fact]
3636
public void WebAppSlotTest()
3737
{
3838
var helper = _collectionState.GetRunner("webapp-management");

0 commit comments

Comments
 (0)