Skip to content

Commit 44f7a23

Browse files
committed
Merge pull request #313 from Azure/clu
Clu
2 parents c2fbd66 + ef850e3 commit 44f7a23

File tree

3 files changed

+66
-66
lines changed

3 files changed

+66
-66
lines changed

examples/webapp-management/01-AppServicePlan.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ tier="Standard"
99
size="Medium"
1010
capacity=2
1111
skuName="S2"
12-
azure group create --name "$groupName" --location "$location"
12+
az group create --name "$groupName" --location "$location"
1313

1414
printf "\n1. Create a new app service plan %s " "$whpName"
15-
azure app service plan create -n "$whpName" -g "$groupName" -l "$location" --tier "$tier" --size "$size" --workers "$capacity"
15+
az app service plan create -n "$whpName" -g "$groupName" -l "$location" --tier "$tier" --size "$size" --workers "$capacity"
1616

1717
printf "\n2. Get information about the app service plan : %s.\n" "$whpName"
18-
whpInfo=`azure app service plan get --name $whpName --group $groupName`
18+
whpInfo=`az app service plan get --name $whpName --group $groupName`
1919

2020
printf "\nValidating app service plan name: %s\n" "$whpName"
2121
[ $(echo $whpInfo | jq '.name' --raw-output) == "$whpName" ]
@@ -28,7 +28,7 @@ printf "\n3. Set the appservice plan: %s " "$whpName"
2828
newTier="Shared"
2929
newCapacity=0
3030
newSize="Medium"
31-
setPlanInfo=`azure app service plan set -n $whpName -g $groupName --tier $newTier --workers --workers $newCapacity --size $newSize`
31+
setPlanInfo=`az app service plan set -n $whpName -g $groupName --tier $newTier --workers --workers $newCapacity --size $newSize`
3232
[ $(echo $setPlanInfo | jq '.name' --raw-output) == "$whpName" ]
3333
[ $(echo $setPlanInfo | jq '.sku.tier' --raw-output) == "$newTier" ]
3434
[ $(echo $setPlanInfo | jq '.sku.capacity' --raw-output) -eq $newCapacity ]
@@ -38,32 +38,32 @@ setPlanInfo=`azure app service plan set -n $whpName -g $groupName --tier $newTie
3838
whpName2=`randomName testplan`
3939
printf "\n4. Creating a new app service plan: %s" "$whpName2"
4040
location2="East US"
41-
azure app service plan create -n "$whpName2" -g "$groupName" -l "$location2" --tier "$tier" --size "$size" --workers "$capacity"
41+
az app service plan create -n "$whpName2" -g "$groupName" -l "$location2" --tier "$tier" --size "$size" --workers "$capacity"
4242

4343
printf "\n5. Get All app service plans by name: %s" "$whpName2"
44-
whpInfo2=`azure app service plan get --name $whpName2`
44+
whpInfo2=`az app service plan get --name $whpName2`
4545
[ $(echo $whpInfo | jq '.name' --raw-output) == "$whpName2" ]
4646
[ $(echo $whpInfo | jq '.location' --raw-output) == "$location2" ]
4747
[ $(echo $whpInfo | jq '.sku.tier' --raw-output) == "$tier" ]
4848
[ $(echo $whpInfo | jq '.sku.name' --raw-output) == "$skuName" ]
4949
[ $(echo $whpInfo | jq '.sku.capacity' --raw-output) -eq $capacity ]
5050

5151
printf "\n6. Get All app service plans by resource group: %s" "$groupName"
52-
plansByGroup=`azure app service plan get --group $groupName`
52+
plansByGroup=`az app service plan get --group $groupName`
5353
[ $plansByGroup == *"$whpName"* ]
5454
[ $plansByGroup == *"$whpName2"* ]
5555

5656
printf "\n7. Get All app service plans by location: %s" "$location2"
57-
plansByLocation=`azure app service plan get -l $location2`
57+
plansByLocation=`az app service plan get -l $location2`
5858
[ $plansByLocation == *"$whpName2"* ]
5959

6060
printf "\n8. Get All app service plans in a subscription."
61-
plansInSubscription=`azure app service plan get`
61+
plansInSubscription=`az app service plan get`
6262
[ $plansInSubscription == *"$whpName"* ]
6363
[ $plansInSubscription == *"$whpName2"* ]
6464

6565
printf "\n9. Remove app service plan: %s." "$whpName"
66-
azure app service plan remove -n $whpName -g $groupName
66+
az app service plan remove -n $whpName -g $groupName
6767

6868
printf "\n10. Remove app service plan: %s." "$whpName2"
69-
azure app service plan remove -n $whpName2 -g $groupName
69+
az app service plan remove -n $whpName2 -g $groupName

examples/webapp-management/02-WebAppSlot.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,37 @@ tier="Standard"
1717
apiversion="2015-08-01"
1818
resourceType="Microsoft.Web/sites"
1919

20-
azure group create --name "$groupName" --location "$location"
20+
az group create --name "$groupName" --location "$location"
2121

2222
printf "\n1. Create a new app service plan %s " "$planName"
23-
azure app service plan create -n "$planName" -g "$groupName" -l "$location" --tier "$tier"
23+
az app service plan create -n "$planName" -g "$groupName" -l "$location" --tier "$tier"
2424

2525
printf "\n2. Create a new web app %s " "$appName"
26-
webappInfo=`azure webapp create -g "$groupName" -n "$appName" -l "$location" --plan "$planName"`
26+
webappInfo=`az webapp create -g "$groupName" -n "$appName" -l "$location" --plan "$planName"`
2727

2828
printf "\nValidating web app name %s " "$appName"
2929
[ $(echo $webappInfo | jq '.name' --raw-output) == "$appName" ]
3030

3131
printf "\n3. Create a web app slot %s " "$slotname1"
32-
slot1=`azure webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname1"`
32+
slot1=`az webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname1"`
3333
appWithSlotName1="$appName/$slotname1"
3434

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

3838
printf "\nValidating web app slot get for %s " "$slotname1"
39-
slot1=`azure webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"`
39+
slot1=`az webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"`
4040
[ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotName1" ]
4141

4242
printf "\nValidating web app slot via pipline obj for %s " "$slotname1"
43-
slot1=`echo "$webappInfo" | azure webapp slot get --slot "$slotname1"`
43+
slot1=`echo "$webappInfo" | az webapp slot get --slot "$slotname1"`
4444

4545
printf "\n4. Create another web app slot %s " "$slotname2"
46-
slot2=`azure webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname2"`
46+
slot2=`az webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname2"`
4747
appWithSlotName2="$appName/$slotname2"
4848

4949
printf "\n5. Get the webapp slots:"
50-
slots=`azure webapp slot get -g "$groupName" -n "$appName"`
50+
slots=`az webapp slot get -g "$groupName" -n "$appName"`
5151
slotN1=`echo $slots | jq '.[0].name'`
5252
slotN2=`echo $slots | jq '.[1].name'`
5353
slotNames=`echo $slotN1 $slotN2`
@@ -74,7 +74,7 @@ startTime=`date +"%A, %B %d, %Y %X" --date "3 hour ago"`
7474
$metricsNames="\"('CPU', 'Requests')\""
7575

7676
# !Not able to test since complex object issue.
77-
metrics=`azure webapp slot metrics get -g "$groupName" -n "$appName" --slot "$slotname1" --granularity PT1M --starttime "$startTime" --endtime "$endTime" --metrics "$metricsNames"`
77+
metrics=`az webapp slot metrics get -g "$groupName" -n "$appName" --slot "$slotname1" --granularity PT1M --starttime "$startTime" --endtime "$endTime" --metrics "$metricsNames"`
7878

7979
printf "\nValidating web app slot metrics %s " "$slotname1"
8080
for i in $metricsNames
@@ -86,57 +86,57 @@ done
8686
printf "\nValidating web app slot metrics via pipline obj %s " "$slotname1"
8787

8888
printf "\n12. Stop web app slot: %s." "$slotname1"
89-
slot1=`echo "$slot1" | azure webapp slot stop`
89+
slot1=`echo "$slot1" | az webapp slot stop`
9090
printf "\nValidating web app slot %s stopped " "$slotname1"
9191
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Stopped" ]
9292

9393
printf "\n13 Stop web app slot: %s." "$slotname1"
94-
slot1=`echo "$slot1" | azure webapp slot start`
94+
slot1=`echo "$slot1" | az webapp slot start`
9595
printf "\nValidating web app slot %s running " "$slotname1"
9696
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
9797

9898
printf "\n14 Stop web app slot: %s." "$slotname1"
99-
slot1=`echo "$slot1" | azure webapp slot stop`
99+
slot1=`echo "$slot1" | az webapp slot stop`
100100
printf "\nValidating web app slot %s stopped " "$slotname1"
101101
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Stopped" ]
102102

103103
printf "\n15 Stop web app slot: %s." "$slotname1"
104-
slot1=`echo "$slot1" | azure webapp slot start`
104+
slot1=`echo "$slot1" | az webapp slot start`
105105
printf "\nValidating web app slot %s running " "$slotname1"
106106
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
107107

108108
printf "\n16 Restart web app slot: %s." "$slotname1"
109-
slot1=`echo "$slot1" | azure webapp slot restart`
109+
slot1=`echo "$slot1" | az webapp slot restart`
110110
printf "\nValidating web app slot %s Running " "$slotname1"
111111
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
112112

113113
printf "\n17 Restart web app slot: %s." "$slotname1"
114-
slot1=`echo "$slot1" | azure webapp slot restart`
114+
slot1=`echo "$slot1" | az webapp slot restart`
115115
printf "\nValidating web app slot %s Running " "$slotname1"
116116
[ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ]
117117

118118
# Clone ------
119119
# !Not able to test since complex object input issue.
120120
# printf "\n10. Clone web app slot: %s." "$slotname1"
121-
# slotClone=`azure web app slot clone`
121+
# slotClone=`az web app slot clone`
122122
# appWithSlotNameClone="$appName/slotname1"
123123

124124
# printf "\nValidating cloned web app slot %s " "$slotname1"
125125
# [ $(echo $slotClone | jq '.name' --raw-output) == "$appWithSlotNameClone" ]
126126

127127
# printf "\nValidating web app slot get for %s " "$slotname1"
128-
# slot1=`azure webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"`
128+
# slot1=`az webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"`
129129
# [ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotNameClone" ]
130130
#-------
131131

132132
# Cleanup
133133
printf "\n20. Remove web app slot: %s." "$slotname1"
134-
azure webapp slot remove -g "$groupName" -n "$appName" --slot "$slotname1"
134+
az webapp slot remove -g "$groupName" -n "$appName" --slot "$slotname1"
135135

136136
printf "\n20. Remove web app: %s." "$appName"
137-
azure webapp remove -g "$groupName" -n "$appName"
137+
az webapp remove -g "$groupName" -n "$appName"
138138

139139
printf "\n20. Remove app service plan: %s." "$planName"
140-
azure app service plan remove -g "$groupName" -n "$planName"
140+
az app service plan remove -g "$groupName" -n "$planName"
141141

142142
printf "\n20. Remove resource group: %s." "$groupName"

0 commit comments

Comments
 (0)