3
3
printf " \n=== Managing Web App Slot in Azure ===\n"
4
4
5
5
pingwebapp () {
6
- url=` echo " $1 " | jq ' ."properties.hostNames "[0]' --raw-output`
6
+ url=` echo " $1 " | jq ' ."HostNames "[0]' --raw-output`
7
7
curl -I ` echo " $url " `
8
8
}
9
9
@@ -27,18 +27,18 @@ printf "\n2. Create a new web app %s " "$appName1"
27
27
webappInfo1=` az appservice create -g " $groupName " -n " $appName1 " -l " $location " --plan " $planName1 " `
28
28
29
29
printf " \nValidating web app name %s " " $appName1 "
30
- [ $( echo $webappInfo1 | jq ' .name ' --raw-output) == " $appName1 " ]
30
+ [ $( echo $webappInfo1 | jq ' .Name ' --raw-output) == " $appName1 " ]
31
31
32
32
printf " \n3. Create a web app slot %s " " $slotname1 "
33
33
slot1=` az appservice slot create -g " $groupName " --plan " $planName1 " -n " $appName1 " --slot " $slotname1 " `
34
34
appWithSlotName1=" $appName1 /$slotname1 "
35
35
36
36
printf " \nValidating web app slot %s " " $slotname1 "
37
- [ $( echo $slot1 | jq ' .name ' --raw-output) == " $appWithSlotName1 " ]
37
+ [ $( echo $slot1 | jq ' .Name ' --raw-output) == " $appWithSlotName1 " ]
38
38
39
39
printf " \nValidating web app slot get for %s " " $slotname1 "
40
40
slot1=` az appservice slot ls -g " $groupName " -n " $appName1 " --slot " $slotname1 " `
41
- [ $( echo $slot1 | jq ' .name ' --raw-output) == " $appWithSlotName1 " ]
41
+ [ $( echo $slot1 | jq ' .Name ' --raw-output) == " $appWithSlotName1 " ]
42
42
43
43
printf " \nValidating web app slot via pipline obj for %s " " $slotname1 "
44
44
slot1=` echo " $webappInfo1 " | az appservice slot ls --slot " $slotname1 " `
@@ -49,22 +49,22 @@ appWithSlotName2="$appName1/$slotname2"
49
49
50
50
printf " \n5. Get the webapp slots:"
51
51
slots=` az appservice slot ls -g " $groupName " -n " $appName1 " `
52
- slotN1=` echo $slots | jq ' .[0].name ' `
53
- slotN2=` echo $slots | jq ' .[1].name ' `
52
+ slotN1=` echo $slots | jq ' .[0].Name ' `
53
+ slotN2=` echo $slots | jq ' .[1].Name ' `
54
54
slotNames=` echo $slotN1 $slotN2 `
55
55
56
56
printf " \nValidating web app slots %s " " $slotname1 and $slotname2 "
57
57
[[ $slotNames == * " $appWithSlotName1 " * ]]
58
58
[[ $slotNames == * " $appWithSlotName2 " * ]]
59
59
60
60
printf " \n6. Change web app slot %s service plan" " $slotname2 "
61
- servicePlanInfo2=` az app service plan create -n " $planName2 " -g " $groupName " -l " $location " --tier " $tier2 " `
61
+ servicePlanInfo2=` az appservice plan create -n " $planName2 " -g " $groupName " -l " $location " --tier " $tier2 " `
62
62
# slot3=`az appservice slot create -g "$groupName" --plan "$planName3" -n "$appName" --slot "$slotname2"`
63
63
slot1=` az appservice slot set -g " $groupName " -n " $appName1 " --slot " $slotname1 " --plan " $planName2 " `
64
64
65
65
printf " \nValidating web app slots %s " " $slotname1 "
66
- [ $( echo $slot1 | jq ' .name ' --raw-output) == " $appName1 /$slotname1 " ]
67
- [[ $( echo $slot1 | jq ' ."properties.serverFarmId "' ) == * " $planName2 " * ]]
66
+ [ $( echo $slot1 | jq ' .Name ' --raw-output) == " $appName1 /$slotname1 " ]
67
+ [[ $( echo $slot1 | jq ' ."ServerFarmId "' ) == * " $planName2 " * ]]
68
68
69
69
printf " \n7. Set web app slot %s config properties"
70
70
# Unable to test pipline. verity property name and value instead.
@@ -77,11 +77,11 @@ slot1=`az appservice slot set -g "$groupName" --plan "$planName1" -n "$appName1"
77
77
printf " \n9. Get web app slot %s publishing profile" " $slotname1 "
78
78
outputFile1=" webappslot-profile-1"
79
79
outputFile2=" webappslot-profile-2"
80
- az appservice slot profile get -g " $groupName " -n " $appName1 " --slot " $slotname1 " --outputfile " $outputFile1 "
80
+ az appservice slot profile ls -g " $groupName " -n " $appName1 " --slot " $slotname1 " --outputfile " $outputFile1 "
81
81
82
82
printf " \n10. Get web app slot %s publishing profile via pipline obj" " $slotname1 "
83
83
# Unable to test pipline. verity property name and value instead.
84
- # echo "$slot1" | az appservice slot profile get --outputfile "$outputFile2"
84
+ # echo "$slot1" | az appservice slot profile ls --outputfile "$outputFile2"
85
85
86
86
printf " \nValidating web app slot profile output file"
87
87
[ -s " $outputFile1 " ]
@@ -100,72 +100,72 @@ metrics=`az appservice slot metrics ls -g "$groupName" -n "$appName1" --slot "$s
100
100
101
101
printf " \nValidating web app slot metrics via pipline obj %s " " $slotname1 "
102
102
# Unable to test pipline. verity property name and value instead.
103
- # echo "$slot1" | az appservice slot metrics get --metrics "$metricsNames" --starttime "$startTime" --endtime "$endTime" --granularity PT1M
103
+ # echo "$slot1" | az appservice slot metrics ls --metrics "$metricsNames" --starttime "$startTime" --endtime "$endTime" --granularity PT1M
104
104
105
105
printf " \n12. Stop web app slot: %s." " $slotname1 "
106
106
slot1=` echo " $slot1 " | az appservice slot stop`
107
107
printf " \nValidating web app slot %s stopped " " $slotname1 "
108
- [ $( echo $slot1 | jq ' ."properties.state "' --raw-output) == " Stopped" ]
108
+ [ $( echo $slot1 | jq ' ."State "' --raw-output) == " Stopped" ]
109
109
110
110
printf " \n13 Stop web app slot: %s." " $slotname1 "
111
111
slot1=` echo " $slot1 " | az appservice slot start`
112
112
printf " \nValidating web app slot %s running " " $slotname1 "
113
- [ $( echo $slot1 | jq ' ."properties.state "' --raw-output) == " Running" ]
113
+ [ $( echo $slot1 | jq ' ."State "' --raw-output) == " Running" ]
114
114
115
115
printf " \n14 Stop web app slot: %s." " $slotname1 "
116
116
slot1=` echo " $slot1 " | az appservice slot stop`
117
117
printf " \nValidating web app slot %s stopped " " $slotname1 "
118
- [ $( echo $slot1 | jq ' ."properties.state "' --raw-output) == " Stopped" ]
118
+ [ $( echo $slot1 | jq ' ."State "' --raw-output) == " Stopped" ]
119
119
120
120
printf " \n15 Stop web app slot: %s." " $slotname1 "
121
121
slot1=` echo " $slot1 " | az appservice slot start`
122
122
printf " \nValidating web app slot %s running " " $slotname1 "
123
- [ $( echo $slot1 | jq ' ."properties.state "' --raw-output) == " Running" ]
123
+ [ $( echo $slot1 | jq ' ."State "' --raw-output) == " Running" ]
124
124
125
125
printf " \n16 Restart web app slot: %s." " $slotname1 "
126
126
slot1=` az appservice slot restart -g " $groupName " -n " $appName1 " --slot " $slotname1 " `
127
127
printf " \nValidating web app slot %s Running " " $slotname1 "
128
- [ $( echo $slot1 | jq ' ."properties.state "' --raw-output) == " Running" ]
128
+ [ $( echo $slot1 | jq ' ."State "' --raw-output) == " Running" ]
129
129
130
130
printf " \n17 Restart web app slot: %s with pipline object." " $slotname1 "
131
131
slot1=` echo " $slot1 " | az appservice slot restart`
132
132
printf " \nValidating web app slot %s Running " " $slotname1 "
133
- [ $( echo $slot1 | jq ' ."properties.state "' --raw-output) == " Running" ]
133
+ [ $( echo $slot1 | jq ' ."State "' --raw-output) == " Running" ]
134
134
135
135
# Need to create a 'Premium' plan for clone test
136
136
printf " \n18. Create a new web app for clone testing"
137
137
location1=" eastus"
138
138
139
- az app service plan set -n " $planName1 " -g " $groupName " --tier " $tier2 "
139
+ az appservice plan set -n " $planName1 " -g " $groupName " --tier " $tier2 "
140
140
webappInfo2=` az appservice create -g " $groupName " -n " $appName3 " -l " $location " --plan " $planName1 " `
141
141
142
142
printf " \n19. Clone web app slot to a slot."
143
143
slotClone=` az appservice slot create -g " $groupName " -n " $appName3 " --slot " $slotname3 " --sourcewebapp " $webappInfo2 " `
144
144
appWithSlotNameClone=" $appName3 /$slotname3 "
145
145
146
146
printf " \nValidating cloned web app slot %s " " $slotname3 "
147
- [ $( echo $slotClone | jq ' .name ' --raw-output) == " $appWithSlotNameClone " ]
147
+ [ $( echo $slotClone | jq ' .Name ' --raw-output) == " $appWithSlotNameClone " ]
148
148
149
149
printf " \nValidating web app slot get for %s " " $slotname3 "
150
- slotClone=` az appservice slot get -g " $groupName " -n " $appName3 " --slot " $slotname3 " `
151
- [ $( echo $slotClone | jq ' .name ' --raw-output) == " $appWithSlotNameClone " ]
150
+ slotClone=` az appservice slot ls -g " $groupName " -n " $appName3 " --slot " $slotname3 " `
151
+ [ $( echo $slotClone | jq ' .Name ' --raw-output) == " $appWithSlotNameClone " ]
152
152
153
153
printf " \n20. Create a new web app for clone testing"
154
154
slot2=` az appservice slot create -g " $groupName " --plan " $planName1 " -n " $appName3 " --slot " $slotname3 " `
155
155
156
156
printf " \n21. Create a new web app for clone testing"
157
- servicePlan=` az app service plan create -n " $planName3 " -g " $groupName " -l " $location1 " --tier " $tier2 " `
157
+ servicePlan=` az appservice plan create -n " $planName3 " -g " $groupName " -l " $location1 " --tier " $tier2 " `
158
158
webappInfo3=` az appservice create -g " $groupName " -n " $appName4 " -l " $location1 " --plan " $planName3 " `
159
159
slot3=` az appservice slot create -g " $groupName " --plan " $planName3 " -n " $appName4 " --slot " $slotname3 " --sourcewebapp " $slot2 " `
160
160
161
- printf " \nValidating web app slot get for %s " " $slotname3 "
161
+ printf " \nValidating web app slot ls for %s " " $slotname3 "
162
162
appWithSlotName3=" $appName4 /$slotname3 "
163
- [ $( echo $slot3 | jq ' .name ' --raw-output) == " $appWithSlotName3 " ]
163
+ [ $( echo $slot3 | jq ' .Name ' --raw-output) == " $appWithSlotName3 " ]
164
164
165
165
# Cleanup
166
166
printf " \n22. Remove web app slot: %s." " $slotname1 "
167
167
az appservice slot rm -g " $groupName " -n " $appName1 " --slot " $slotname1 " --force
168
168
az appservice slot rm -g " $groupName " -n " $appName1 " --slot " $slotname2 " --force
169
169
170
170
printf " \n23. Remove resource group: %s." " $groupName "
171
- az group rm --name " $groupName " --force
171
+ az resourcemanager group rm --name " $groupName " --force
0 commit comments