From 455c1daaa1c6accfffe6910b9c4a1286c9a74a64 Mon Sep 17 00:00:00 2001 From: yugangw-msft Date: Wed, 6 Jan 2016 11:48:31 -0800 Subject: [PATCH 1/4] rename azure.sh to az.sh --- .../01-VirtualMachineSizes.sh | 10 +++++----- .../02-VirtualMachineCreation.sh | 14 ++++++------- examples/lib/loginService.sh | 2 +- examples/lib/loginUser.sh | 2 +- examples/lib/testrunner.sh | 2 +- .../resource-management/01-ResourceGroups.sh | 10 +++++----- examples/resource-management/02-Resource.sh | 20 +++++++++---------- .../resource-management/03-Deployments.sh | 8 ++++---- .../resource-management/04-RoleAssignments.sh | 14 ++++++------- .../resource-management/05-RoleDefinitions.sh | 10 +++++----- .../virtual-hard-disk/01-VirtualHardDisks.sh | 10 +++++----- tools/CLU/BuildAndInstallClu.bat | 12 ++++++----- tools/CLU/SetupEnv.bat | 4 ++-- tools/CLU/{azure.sh => az.sh} | 0 tools/CLU/{azure.win.sh => az.win.sh} | 0 15 files changed, 60 insertions(+), 58 deletions(-) rename tools/CLU/{azure.sh => az.sh} (100%) rename tools/CLU/{azure.win.sh => az.win.sh} (100%) diff --git a/examples/compute-management/01-VirtualMachineSizes.sh b/examples/compute-management/01-VirtualMachineSizes.sh index 8326a3f9baa2..0256d6a93a6c 100644 --- a/examples/compute-management/01-VirtualMachineSizes.sh +++ b/examples/compute-management/01-VirtualMachineSizes.sh @@ -3,10 +3,10 @@ set -e printf "\n=== Managing Virtual Machine Sizes in Azure Compute ===\n" printf "\n1. Showing VM size results in location: %s.\n" "$location" -azure vmsize get --location "$location" +az vmsize get --location "$location" printf "\n2. Checking VM size results in location: %s.\n" "$location" -vmSizeResult=`azure vmsize get --location "$location"` +vmSizeResult=`az vmsize get --location "$location"` if [[ $vmSizeResult == "" ]]; then echo "Failure: No VM sizes!" 1>&2 @@ -15,7 +15,7 @@ else echo "Success: Non-empty Results." fi -filterResult=`azure vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_A0"))' --raw-output` +filterResult=`az vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_A0"))' --raw-output` if [[ "$filterResult" == "" ]]; then echo "Failure: Standard_A0 vm size not found." 1>&2 exit 1 @@ -23,7 +23,7 @@ else echo "Success: Standard_A0 vm size found." fi -filterResult=`azure vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_G1"))' --raw-output` +filterResult=`az vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_G1"))' --raw-output` if [[ "$filterResult" == "" ]]; then echo "Failure: Standard_G1 vm size not found." 1>&2 exit 1 @@ -31,7 +31,7 @@ else echo "Success: Standard_G1 vm size found." fi -filterResult=`azure vmsize get --location "$location" | cat | jq 'select(.name | contains("NonStandard_A1"))' --raw-output` +filterResult=`az vmsize get --location "$location" | cat | jq 'select(.name | contains("NonStandard_A1"))' --raw-output` if [[ "$filterResult" == "" ]]; then echo "Success: NonStandard_A1 vm size not found." else diff --git a/examples/compute-management/02-VirtualMachineCreation.sh b/examples/compute-management/02-VirtualMachineCreation.sh index 692dc7f9cd82..c3138537b13b 100644 --- a/examples/compute-management/02-VirtualMachineCreation.sh +++ b/examples/compute-management/02-VirtualMachineCreation.sh @@ -3,15 +3,15 @@ set -e printf "\n=== Managing Virtual Machine Creation in Azure Compute ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create -n "$groupName" --location "$location" +az group create -n "$groupName" --location "$location" printf "\n2. Creating a new storage account '%s' in type '%s'.\n" "$storageAccountName" "$storageAccountType" -azure storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType" +az storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType" printf "\n3. Create virtual network.\n" -result=`azure virtual network new --resourcegroupname "$groupName" --name test --location "$location" --addressprefix "[\"10.0.0.0/16\"]" --subnet "[{\"Name\":\"test\",\"AddressPrefix\":\"10.0.0.0/24\"}]" --force` +result=`az virtual network new --resourcegroupname "$groupName" --name test --location "$location" --addressprefix "[\"10.0.0.0/16\"]" --subnet "[{\"Name\":\"test\",\"AddressPrefix\":\"10.0.0.0/24\"}]" --force` -contextResult=`azure context get` +contextResult=`az context get` subId=`echo $contextResult | jq '.Subscription.SubscriptionId' --raw-output` @@ -19,7 +19,7 @@ subnetId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Ne printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnetId='$subnetId'.\n" "$subId" export MSYS_NO_PATHCONV=1 -azure network interface new --name test --resourcegroupname "$groupName" --location "$location" --subnetid "$subnetId" +az network interface new --name test --resourcegroupname "$groupName" --location "$location" --subnetid "$subnetId" export MSYS_NO_PATHCONV= nicId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Network/networkInterfaces/test" @@ -30,7 +30,7 @@ vmStr="{\"Name\":\"test\",\"HardwareProfile\":{\"VmSize\":\"Standard_A1\"},\"Net printf "\n5. Create virtual machine with\r\nnicId='%s'\r\nvhdUri='%s'\r\nvmStr='%s'\n" "$nicId" "$vhdUri" "$vmStr" -azure vm new --resourcegroupname "$groupName" --location "$location" --vmprofile "$vmStr" +az vm new --resourcegroupname "$groupName" --location "$location" --vmprofile "$vmStr" printf "\n6. Removing resource group: %s.\n" "$groupName" -azure group remove -n "$groupName" -f \ No newline at end of file +az group remove -n "$groupName" -f \ No newline at end of file diff --git a/examples/lib/loginService.sh b/examples/lib/loginService.sh index 2b7b738e1674..8140b9f0c410 100644 --- a/examples/lib/loginService.sh +++ b/examples/lib/loginService.sh @@ -1,2 +1,2 @@ #!/bin/bash -azure account add --spn --appid "$spn" --secret "$secret" -t "$tenant" -s "$spnSubscription" \ No newline at end of file +az account add --spn --appid "$spn" --secret "$secret" -t "$tenant" -s "$spnSubscription" \ No newline at end of file diff --git a/examples/lib/loginUser.sh b/examples/lib/loginUser.sh index 154fdce32981..178fec118921 100644 --- a/examples/lib/loginUser.sh +++ b/examples/lib/loginUser.sh @@ -1,2 +1,2 @@ #!/bin/bash -azure account add -u "$azureUser" -p "$password" -s "$userSubscription" \ No newline at end of file +az account add -u "$azureUser" -p "$password" -s "$userSubscription" \ No newline at end of file diff --git a/examples/lib/testrunner.sh b/examples/lib/testrunner.sh index 6e31ad5b95fa..0849c3f24d34 100644 --- a/examples/lib/testrunner.sh +++ b/examples/lib/testrunner.sh @@ -15,7 +15,7 @@ for d in $( ls $TESTDIR/.. --ignore=lib ); do . $f set +e printf "\nCleanup: removing resource group: %s\n" $groupName - azure group remove --name "$groupName" --force + az group remove --name "$groupName" --force set -e echo "success: $f" done diff --git a/examples/resource-management/01-ResourceGroups.sh b/examples/resource-management/01-ResourceGroups.sh index 8673f807ea0b..9d67df4398db 100644 --- a/examples/resource-management/01-ResourceGroups.sh +++ b/examples/resource-management/01-ResourceGroups.sh @@ -3,19 +3,19 @@ set -e printf "\n=== Managing Resource Groups in Azure ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create -n "$groupName" --location "$location" +az group create -n "$groupName" --location "$location" printf "\n2. Updating the group %s with tags.\n" "$groupName" -azure group set -n "$groupName" --tags "[{\"Value\":\"testval\",\"Name\":\"testtag\"}]" +az group set -n "$groupName" --tags "[{\"Value\":\"testval\",\"Name\":\"testtag\"}]" printf "\n3. Get information about resource group : %s.\n" "$groupName" -resourceGroupInfo=`azure group get -n $groupName` +resourceGroupInfo=`az group get -n $groupName` printf "\nValidating resource group name is: %s\n" "$groupName" [ $(echo $resourceGroupInfo | jq '.ResourceGroupName' --raw-output) == "$groupName" ] printf "\n4. Listing all resource groups in the subscription.\n" -azure group get +az group get printf "\n5. Removing resource group: %s.\n" "$groupName" -azure group remove -n "$groupName" -f \ No newline at end of file +az group remove -n "$groupName" -f \ No newline at end of file diff --git a/examples/resource-management/02-Resource.sh b/examples/resource-management/02-Resource.sh index 921969d66b2c..44a036abc7d8 100644 --- a/examples/resource-management/02-Resource.sh +++ b/examples/resource-management/02-Resource.sh @@ -3,44 +3,44 @@ set -e printf "\n=== Managing Resources in Azure ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" destinationGroupName=$groupName"Destination" printf "\n2. Registering Resource Provider Namespace.\n" providerNamespace="Providers.Test" -azure resource provider register --ProviderNamespace $providerNamespace --Force +az resource provider register --ProviderNamespace $providerNamespace --Force printf "\n3. Creating a new Resource: %s.\n" "$resourceName" resourceType="$providerNamespace/statefulResources" tags='[{"Name": "testtag", "Value": "testvalue"}]' properties='{"administratorLogin": "adminuser", "administratorLoginPassword": "P@ssword1"}' apiversion="2014-04-01" -azure resource create --Name $resourceName --Location $location --Tags "$tags" --ResourceGroupName $groupName --ResourceType $resourceType --PropertyObject "$properties" --ApiVersion $apiversion --Force +az resource create --Name $resourceName --Location $location --Tags "$tags" --ResourceGroupName $groupName --ResourceType $resourceType --PropertyObject "$properties" --ApiVersion $apiversion --Force printf "\n4. Get information about Resource : %s.\n" "$resourceName" -resourceInfo=$(azure resource get -n $resourceName) +resourceInfo=$(az resource get -n $resourceName) printf "\nValidating Resource name is: %s\n" "$resourceName" [ $(echo $resourceInfo | jq '.Name' --raw-output) == "$resourceName" ] printf "\n5. Find Resource with name '%s' and type '%s'.\n" "$resourceName" "$resourceType" -foundResource=$(azure resource find -n "$resourceName" -t $resourceType) +foundResource=$(az resource find -n "$resourceName" -t $resourceType) printf "\nValidating Resource name is: %s.\n" "$resourceName" [ $(echo $foundResource | jq '.Name' --raw-output) == "$resourceName" ] printf "\n6. Update Resource.\n" tagsUpdate='[{"Name": "testtagUpdated", "Value": "testvalueUpdated"}]' -azure resource set --ResourceGroupName $groupName --ResourceName $resourceName --ResourceType $resourceType --Tags "$tagsUpdate" -f +az resource set --ResourceGroupName $groupName --ResourceName $resourceName --ResourceType $resourceType --Tags "$tagsUpdate" -f printf "\n7. Move Resource to resource group: %s.\n" "$destinationGroupName" -azure group create --name "$destinationGroupName" --location "$location" +az group create --name "$destinationGroupName" --location "$location" resourceId=$(echo $resourceInfo | jq '.Id') arrayId="[$resourceId]" -azure resource move -g "$destinationGroupName" --ResourceId "$arrayId" -f +az resource move -g "$destinationGroupName" --ResourceId "$arrayId" -f printf "\n8. Removing resource: %s.\n" "$resourceName" -foundResource=$(azure resource find -n "$resourceName" -t $resourceType) +foundResource=$(az resource find -n "$resourceName" -t $resourceType) resourceId=$(echo $foundResource | jq '.Id' --raw-output) echo $resourceId export MSYS_NO_PATHCONV=1 -azure resource remove --Id "$resourceId" -f +az resource remove --Id "$resourceId" -f export MSYS_NO_PATHCONV= \ No newline at end of file diff --git a/examples/resource-management/03-Deployments.sh b/examples/resource-management/03-Deployments.sh index 90c77d060c0f..71c3902e351f 100644 --- a/examples/resource-management/03-Deployments.sh +++ b/examples/resource-management/03-Deployments.sh @@ -3,14 +3,14 @@ set -e printf "\n=== Provisioning Deployments in Azure ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" printf "\n2. Test template with dynamic parameters\n" -azure group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --siteName "$resourceName" --hostingPlanName "$resourceName" --siteLocation "$location" --sku "Standard" --workerSize "0" +az group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --siteName "$resourceName" --hostingPlanName "$resourceName" --siteLocation "$location" --sku "Standard" --workerSize "0" printf "\n3. Test template with JSON parameter object\n" -azure group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --templateparameterobject "{\"siteName\":\"$resourceName\",\"hostingPlanName\":\"$resourceName\",\"siteLocation\":\"$location\",\"sku\":\"Standard\",\"workerSize\": 0 }" +az group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --templateparameterobject "{\"siteName\":\"$resourceName\",\"hostingPlanName\":\"$resourceName\",\"siteLocation\":\"$location\",\"sku\":\"Standard\",\"workerSize\": 0 }" printf "\n4. Provisioning Deployment\n" -deploymentInfo=`azure group deployment create --Name "$resourceName" --ResourceGroupName "$groupName" --TemplateFile $BASEDIR/sampleTemplate.json --TemplateParameterFile $BASEDIR/sampleTemplateParams.json` +deploymentInfo=`az group deployment create --Name "$resourceName" --ResourceGroupName "$groupName" --TemplateFile $BASEDIR/sampleTemplate.json --TemplateParameterFile $BASEDIR/sampleTemplateParams.json` echo $deploymentInfo \ No newline at end of file diff --git a/examples/resource-management/04-RoleAssignments.sh b/examples/resource-management/04-RoleAssignments.sh index 69c7e2235419..bf8746664c38 100644 --- a/examples/resource-management/04-RoleAssignments.sh +++ b/examples/resource-management/04-RoleAssignments.sh @@ -3,24 +3,24 @@ set -e printf "\n=== Managing Role Assignments in Azure ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" printf "\n2. Creating a new Role Assignment.\n" export MSYS_NO_PATHCONV=1 -users=$(azure ad users get) +users=$(az ad users get) userId=$(echo $users | cat | jq '.[0].Id' -s --raw-output) echo "UserID: $userId" -roleDefinitions=$(azure role definition get) +roleDefinitions=$(az role definition get) roleDefinitionId=$(echo $roleDefinitions | cat | jq '.[0].Id' -s --raw-output) echo "RoleDefinitionId: $roleDefinitionId" -subsciptions=$(azure subscription get) +subsciptions=$(az subscription get) subscriptionId=$(echo $subsciptions | cat | jq '.[0].SubscriptionId' -s --raw-output) scope="/subscriptions/$subscriptionId/resourceGroups/$groupName" echo "Scope: $scope" -azure role assignment create --ObjectId "$userId" --RoleDefinitionId "$roleDefinitionId" --Scope "$scope" +az role assignment create --ObjectId "$userId" --RoleDefinitionId "$roleDefinitionId" --Scope "$scope" printf "\n3. Delete last created Role Assignment.\n" -assignments=$(azure role assignment get) +assignments=$(az role assignment get) assignmentId=$(echo $assignments | cat | jq '.[-1].ObjectId' -s --raw-output) -azure role assignment remove --ObjectId "$assignmentId" --Scope "$scope" --RoleDefinitionId "$roleDefinitionId" -f +az role assignment remove --ObjectId "$assignmentId" --Scope "$scope" --RoleDefinitionId "$roleDefinitionId" -f export MSYS_NO_PATHCONV= \ No newline at end of file diff --git a/examples/resource-management/05-RoleDefinitions.sh b/examples/resource-management/05-RoleDefinitions.sh index 6b49103824d1..4b745477bb17 100644 --- a/examples/resource-management/05-RoleDefinitions.sh +++ b/examples/resource-management/05-RoleDefinitions.sh @@ -3,21 +3,21 @@ set -e printf "\n=== Managing Role Definitions in Azure ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" printf "\n2. Creating a new Role Definition.\n" -roleDefinition=$(azure role definition create --inputfile $BASEDIR/roleDefinition.json) +roleDefinition=$(az role definition create --inputfile $BASEDIR/roleDefinition.json) printf "\n3. Get information about Role Definitions.\n" roleDefinitionName=$(echo $roleDefinition | jq '.Name' --raw-output) -azure role definition get -n $roleDefinitionName +az role definition get -n $roleDefinitionName printf "\n4. Update Role Definition.\n" export MSYS_NO_PATHCONV=1 updatedRoleDefinition=$(echo $roleDefinition | jq '.Actions |= .+ ["Microsoft.Authorization/*/write"]') -azure role definition set --Role "$updatedRoleDefinition" +az role definition set --Role "$updatedRoleDefinition" printf "\n5. Delete Role Definition.\n" roleDefinitionId=$(echo $roleDefinition | jq '.Id' --raw-output) -azure role definition remove --Id $roleDefinitionId --PassThru -f +az role definition remove --Id $roleDefinitionId --PassThru -f export MSYS_NO_PATHCONV= diff --git a/examples/virtual-hard-disk/01-VirtualHardDisks.sh b/examples/virtual-hard-disk/01-VirtualHardDisks.sh index fce20b7e0f35..b9e6a58d0631 100644 --- a/examples/virtual-hard-disk/01-VirtualHardDisks.sh +++ b/examples/virtual-hard-disk/01-VirtualHardDisks.sh @@ -3,16 +3,16 @@ set -e printf "\n=== Managing Virtual Hard Disks in Azure Compute ===\n" printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location" -azure group create -n "$groupName" --location "$location" +az group create -n "$groupName" --location "$location" printf "\n2. Creating a new storage account '%s' in type '%s'.\n" "$storageAccountName" "$storageAccountType" -azure storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType" +az storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType" printf "\n3. Uploading a virtual hard disk to: %s.\n" "$storageAccountName" -azure vhd add -o --resourcegroupname "$groupName" --destination https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath $BASEDIR/test.vhd +az vhd add -o --resourcegroupname "$groupName" --destination https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath $BASEDIR/test.vhd printf "\n4. Downloading a virtual hard disk" -azure vhd save -o --resourcegroupname "$groupName" --sourceuri https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath ./test_downloaded_by_clu.vhd +az vhd save -o --resourcegroupname "$groupName" --sourceuri https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath ./test_downloaded_by_clu.vhd printf "\n5. Validating the downloaded file is the same.\n" diffResult=`diff ./test_downloaded_by_clu.vhd $BASEDIR/test_uploaded_byps.vhd` @@ -25,4 +25,4 @@ else fi printf "\n6. Removing resource group: %s.\n" "$groupName" -azure group remove -n "$groupName" -f \ No newline at end of file +az group remove -n "$groupName" -f \ No newline at end of file diff --git a/tools/CLU/BuildAndInstallClu.bat b/tools/CLU/BuildAndInstallClu.bat index 971a90d5f094..bf91dc53f871 100644 --- a/tools/CLU/BuildAndInstallClu.bat +++ b/tools/CLU/BuildAndInstallClu.bat @@ -36,15 +36,17 @@ echo ^(Get-Content "%mscluCfg%"^) ^| ForEach-Object { $_ -replace "TOFILL", "%ro %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Management.Storage %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Compute +rename %root%\drop\clurun\win7-x64\azure.bat az.bat + REM setup osx and linux bits which can be xcopied and run. REM note, for known nuget bugs, skip --install by copying over cmdlet packages. xcopy %root%\drop\clurun\win7-x64\pkgs %root%\drop\clurun\osx.10.10-x64\pkgs /S /Q /I /Y copy /Y %root%\drop\clurun\win7-x64\azure.lx %root%\drop\clurun\osx.10.10-x64 copy /Y %root%\drop\clurun\win7-x64\msclu.cfg %root%\drop\clurun\osx.10.10-x64 -REM: copy over the pre-cooked azure.sh and ensure correct line endings -copy /Y %~dp0\azure.sh %root%\drop\clurun\osx.10.10-x64\azure -set azuresh=%root%\drop\clurun\osx.10.10-x64\azure +REM: copy over the pre-cooked az.sh and ensure correct line endings +copy /Y %~dp0\az.sh %root%\drop\clurun\osx.10.10-x64\az +set azuresh=%root%\drop\clurun\osx.10.10-x64\az echo Get-ChildItem %azuresh% ^| ForEach-Object { > %temp%\fixLineEndings.ps1 echo $contents = [IO.File]::ReadAllText($_) -replace "`r`n?", "`n" >> %temp%\fixLineEndings.ps1 echo [IO.File]::WriteAllText($_, $contents) >> %temp%\fixLineEndings.ps1 @@ -54,7 +56,7 @@ echo } >> %temp%\fixLineEndings.ps1 xcopy %root%\drop\clurun\win7-x64\pkgs %root%\drop\clurun\ubuntu.14.04-x64\pkgs /S /Q /I /Y copy /Y %root%\drop\clurun\win7-x64\azure.lx %root%\drop\clurun\ubuntu.14.04-x64 copy /Y %root%\drop\clurun\win7-x64\msclu.cfg %root%\drop\clurun\ubuntu.14.04-x64 -copy /Y %azuresh% %root%\drop\clurun\ubuntu.14.04-x64\azure +copy /Y %azuresh% %root%\drop\clurun\ubuntu.14.04-x64\az REM, windows version also needs it for bash based testing -copy /Y %~dp0\azure.win.sh %root%\drop\clurun\win7-x64\azure +copy /Y %~dp0\az.win.sh %root%\drop\clurun\win7-x64\az diff --git a/tools/CLU/SetupEnv.bat b/tools/CLU/SetupEnv.bat index 38a226dad905..f8856b15a5f6 100644 --- a/tools/CLU/SetupEnv.bat +++ b/tools/CLU/SetupEnv.bat @@ -5,8 +5,8 @@ REM build cmdlets packages set DebugCLU= call %~dp0\BuildAndInstallClu.bat set Path=%Path%;%CLUROOT%\drop\clurun\win7-x64 -REM run 'azure help' to verify all are wired up -azure.bat help +REM run 'az help' to verify all are wired up +az.bat help if ERRORLEVEL 1 ( echo Build and deploy clu package failed exit /B 1 diff --git a/tools/CLU/azure.sh b/tools/CLU/az.sh similarity index 100% rename from tools/CLU/azure.sh rename to tools/CLU/az.sh diff --git a/tools/CLU/azure.win.sh b/tools/CLU/az.win.sh similarity index 100% rename from tools/CLU/azure.win.sh rename to tools/CLU/az.win.sh From e7701e3bba342e2bf04704f58900d29f63903552 Mon Sep 17 00:00:00 2001 From: yugangw-msft Date: Wed, 6 Jan 2016 21:56:38 -0800 Subject: [PATCH 2/4] update clu run code to produce az.bat --- src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs b/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs index 90cf62b763d8..aa1b3e249f60 100644 --- a/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs +++ b/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs @@ -534,6 +534,7 @@ private static void GenerateScript(string cfgPath) { var scriptPath = GetScriptPath(cfgPath); var scriptName = Path.GetFileNameWithoutExtension(scriptPath); + var ScriptBaseName = "az"; if (File.Exists(scriptPath)) return; @@ -544,7 +545,7 @@ private static void GenerateScript(string cfgPath) { "#!/bin/bash", "SCRIPTPATH=$(dirname \"$0\")", - $"$SCRIPTPATH/clurun -s {scriptName} -r $SCRIPTPATH/{Path.GetFileName(cfgPath)} \"$@\"" + $"$SCRIPTPATH/clurun -s {ScriptBaseName} -r $SCRIPTPATH/{Path.GetFileName(cfgPath)} \"$@\"" }); System.Diagnostics.Process.Start("chmod", $"777 {scriptPath}"); } @@ -553,7 +554,7 @@ private static void GenerateScript(string cfgPath) File.WriteAllLines(scriptPath, new string[] { "@echo off", - $@"%~dp0\clurun.exe -s {scriptName} -r %~dp0\{Path.GetFileName(cfgPath)} %*" + $@"%~dp0\clurun.exe -s {ScriptBaseName} -r %~dp0\{Path.GetFileName(cfgPath)} %*" }); } } From 851d64de66a352fc1b01a078118be05dbb7ee01c Mon Sep 17 00:00:00 2001 From: yugangw-msft Date: Thu, 7 Jan 2016 16:44:22 -0800 Subject: [PATCH 3/4] replace azure to az --- clu-getstart.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/clu-getstart.md b/clu-getstart.md index 2786bfbf0d7b..54276de8b1cd 100644 --- a/clu-getstart.md +++ b/clu-getstart.md @@ -25,7 +25,7 @@ CLUPackages require some additional files to direct generation of indexing, and | ------------- |:-------------:| | CommandAssemblies | File name of cmdlets assembly(ies) | | NounPrefix | ‘AzureRm’ The part of the cmdlet noun to remove in clu commands| - | NounFirst | if true, the verb comes at the end of the command (e.g. azure resource get)| + | NounFirst | if true, the verb comes at the end of the command (e.g. az resource get)| * \.nuspec.template, which contains nuspec format metadata about the package – the base temaplate is in tools\clu\Microsoft.Azure.Commands.nuspec.template. Here are the special fields defined in this template: * %PackageId% - replace with the module name (Microsoft.Azure.Commands.\) @@ -52,31 +52,31 @@ CLUPackages require some additional files to direct generation of indexing, and 1. Run `\tools\CLU\BuildAndInstallClu.bat` which build and generate all cmdlet packages and deploy to under `\drop\clurun` folder, with 3 flavors `win7-x64`, `osx.10.10-x64` and `ubuntu.14.04-x64`. When you have a clean environment or just pull from upstream, you should clean temporary bits such as `git clean -xdf`, and run this command. 2. Run `\tools\CLU\BuildCmdlet ` ", this will build and refresh an individual cmdlet package. -After #1 above is finished, you can run `drop\clurun\\azure.bat help` to explore. +After #1 above is finished, you can run `drop\clurun\\az.bat help` to explore. To debug, set environment variable of `DebugCLU` to "1". Then on running any command, you will be prompted to attach a debugger. -There is also `\tools\CLU\SetupEnv.bat` which is a windows batch wrapping around the `BuildAndInstallClu.bat`, plus set the `DebugCLU` for you, and add the `drop\clurun\win7-x64\azure.bat` to the PATH environment variable. +There is also `\tools\CLU\SetupEnv.bat` which is a windows batch wrapping around the `BuildAndInstallClu.bat`, plus set the `DebugCLU` for you, and add the `drop\clurun\win7-x64\az.bat` to the PATH environment variable. -To test on osx/linux boxes, do #1, open `\drop\clurun`, copy the flavor folder to your target machine, and run the "azure.sh" inside. Make sure set execution permission using `chmod +x azure.sh clurun` +To test on osx/linux boxes, do #1, open `\drop\clurun`, copy the flavor folder to your target machine, and run the "az.sh" inside. Make sure set execution permission using `chmod +x az.sh clurun` (All of those are subject to change, contact yugangw or adxsdkdev for any questions) ### Quick introductions on cmdlets - * Run commands using the ‘azure’ prefix, cmdlet nouns, and cmdlet verbs, for example, `azure environment get` maps to the cmdlet `Get-AzureRmEnvironment` - * Cmdlet parameters use the double dash (--) so for example, getting a subscription with a particular name would be: `azure subscription get –-SubscriptionName “name of subscription"` + * Run commands using the ‘az’ prefix, cmdlet nouns, and cmdlet verbs, for example, `az environment get` maps to the cmdlet `Get-AzureRmEnvironment` + * Cmdlet parameters use the double dash (--) so for example, getting a subscription with a particular name would be: `az subscription get –-SubscriptionName “name of subscription"` * To log in, 3 options - * login interactively using device flow, this is the only option for msa account or any org-id with 2fa enforced, example: `azure account add` - * login with user and password, this works on org-id w/o 2fa enforced, example: `azure account add --Username user@contoso.org --Password password1` - * login as service principal. Example: `azure account add --ServicePrincipal --TenantId --ApplicationId --Secret ` + * login interactively using device flow, this is the only option for msa account or any org-id with 2fa enforced, example: `az account add` + * login with user and password, this works on org-id w/o 2fa enforced, example: `az account add --Username user@contoso.org --Password password1` + * login as service principal. Example: `az account add --ServicePrincipal --TenantId --ApplicationId --Secret ` * Piping between cmdlets should work the same way that Powerhell piping works - ```azure subscription get --SubscriptionName | azure context set``` + ```az subscription get --SubscriptionName | az context set``` * You can capture piped output using redirection to a file - the result will be the json serialization of the output object. - ```azure subscription get > subscriptions.json``` + ```az subscription get > subscriptions.json``` * You can use file input tu aparameter using '@' notation: - ```azure command --param1 @file1.json``` + ```az command --param1 @file1.json``` Reads input from file1.json and attempts to deserialize the .net object that is the Parameter type for ```param1``` - ```azure command --param1 @@file1.json``` + ```az command --param1 @@file1.json``` Does the same thing, but treats the input from ```file1.json``` as if it come from the pipeline, so that multiple objects will result in multiple invocations of ```ProcessRecord()``` for the target cmdlet. * There are some known issues with the current approach to sessions, which can cause session variables to not be propagated when running cmdlets in a pipeline, to work around this, set the 'CmdletSessionId' environment variable to a numeric value - all cmdlets running from the shell will use that session id, and sessions will work with pipelining From 7fb2786b386eca1a3fc36b7636698ca8b8678dda Mon Sep 17 00:00:00 2001 From: yugangw-msft Date: Fri, 8 Jan 2016 11:10:34 -0800 Subject: [PATCH 4/4] update webapp from azure to az --- .../webapp-management/01-AppServicePlan.sh | 22 +++--- examples/webapp-management/02-WebAppSlot.sh | 40 +++++------ examples/webapp-management/03-WebApp.sh | 70 +++++++++---------- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/examples/webapp-management/01-AppServicePlan.sh b/examples/webapp-management/01-AppServicePlan.sh index 3c05190f2cbe..8e75d9bde3b5 100644 --- a/examples/webapp-management/01-AppServicePlan.sh +++ b/examples/webapp-management/01-AppServicePlan.sh @@ -9,13 +9,13 @@ tier="Standard" size="Medium" capacity=2 skuName="S2" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" printf "\n1. Create a new app service plan %s " "$whpName" -azure app service plan create -n "$whpName" -g "$groupName" -l "$location" --tier "$tier" --size "$size" --workers "$capacity" +az app service plan create -n "$whpName" -g "$groupName" -l "$location" --tier "$tier" --size "$size" --workers "$capacity" printf "\n2. Get information about the app service plan : %s.\n" "$whpName" -whpInfo=`azure app service plan get --name $whpName --group $groupName` +whpInfo=`az app service plan get --name $whpName --group $groupName` printf "\nValidating app service plan name: %s\n" "$whpName" [ $(echo $whpInfo | jq '.name' --raw-output) == "$whpName" ] @@ -28,7 +28,7 @@ printf "\n3. Set the appservice plan: %s " "$whpName" newTier="Shared" newCapacity=0 newSize="Medium" -setPlanInfo=`azure app service plan set -n $whpName -g $groupName --tier $newTier --workers --workers $newCapacity --size $newSize` +setPlanInfo=`az app service plan set -n $whpName -g $groupName --tier $newTier --workers --workers $newCapacity --size $newSize` [ $(echo $setPlanInfo | jq '.name' --raw-output) == "$whpName" ] [ $(echo $setPlanInfo | jq '.sku.tier' --raw-output) == "$newTier" ] [ $(echo $setPlanInfo | jq '.sku.capacity' --raw-output) -eq $newCapacity ] @@ -38,10 +38,10 @@ setPlanInfo=`azure app service plan set -n $whpName -g $groupName --tier $newTie whpName2=`randomName testplan` printf "\n4. Creating a new app service plan: %s" "$whpName2" location2="East US" -azure app service plan create -n "$whpName2" -g "$groupName" -l "$location2" --tier "$tier" --size "$size" --workers "$capacity" +az app service plan create -n "$whpName2" -g "$groupName" -l "$location2" --tier "$tier" --size "$size" --workers "$capacity" printf "\n5. Get All app service plans by name: %s" "$whpName2" -whpInfo2=`azure app service plan get --name $whpName2` +whpInfo2=`az app service plan get --name $whpName2` [ $(echo $whpInfo | jq '.name' --raw-output) == "$whpName2" ] [ $(echo $whpInfo | jq '.location' --raw-output) == "$location2" ] [ $(echo $whpInfo | jq '.sku.tier' --raw-output) == "$tier" ] @@ -49,21 +49,21 @@ whpInfo2=`azure app service plan get --name $whpName2` [ $(echo $whpInfo | jq '.sku.capacity' --raw-output) -eq $capacity ] printf "\n6. Get All app service plans by resource group: %s" "$groupName" -plansByGroup=`azure app service plan get --group $groupName` +plansByGroup=`az app service plan get --group $groupName` [ $plansByGroup == *"$whpName"* ] [ $plansByGroup == *"$whpName2"* ] printf "\n7. Get All app service plans by location: %s" "$location2" -plansByLocation=`azure app service plan get -l $location2` +plansByLocation=`az app service plan get -l $location2` [ $plansByLocation == *"$whpName2"* ] printf "\n8. Get All app service plans in a subscription." -plansInSubscription=`azure app service plan get` +plansInSubscription=`az app service plan get` [ $plansInSubscription == *"$whpName"* ] [ $plansInSubscription == *"$whpName2"* ] printf "\n9. Remove app service plan: %s." "$whpName" -azure app service plan remove -n $whpName -g $groupName +az app service plan remove -n $whpName -g $groupName printf "\n10. Remove app service plan: %s." "$whpName2" -azure app service plan remove -n $whpName2 -g $groupName \ No newline at end of file +az app service plan remove -n $whpName2 -g $groupName diff --git a/examples/webapp-management/02-WebAppSlot.sh b/examples/webapp-management/02-WebAppSlot.sh index 65c4cebe601e..51cbd9c1f330 100644 --- a/examples/webapp-management/02-WebAppSlot.sh +++ b/examples/webapp-management/02-WebAppSlot.sh @@ -17,37 +17,37 @@ tier="Standard" apiversion="2015-08-01" resourceType="Microsoft.Web/sites" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" printf "\n1. Create a new app service plan %s " "$planName" -azure app service plan create -n "$planName" -g "$groupName" -l "$location" --tier "$tier" +az app service plan create -n "$planName" -g "$groupName" -l "$location" --tier "$tier" printf "\n2. Create a new web app %s " "$appName" -webappInfo=`azure webapp create -g "$groupName" -n "$appName" -l "$location" --plan "$planName"` +webappInfo=`az webapp create -g "$groupName" -n "$appName" -l "$location" --plan "$planName"` printf "\nValidating web app name %s " "$appName" [ $(echo $webappInfo | jq '.name' --raw-output) == "$appName" ] printf "\n3. Create a web app slot %s " "$slotname1" -slot1=`azure webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname1"` +slot1=`az webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname1"` appWithSlotName1="$appName/$slotname1" printf "\nValidating web app slot %s " "$slotname1" [ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotName1" ] printf "\nValidating web app slot get for %s " "$slotname1" -slot1=`azure webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"` +slot1=`az webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"` [ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotName1" ] printf "\nValidating web app slot via pipline obj for %s " "$slotname1" -slot1=`echo "$webappInfo" | azure webapp slot get --slot "$slotname1"` +slot1=`echo "$webappInfo" | az webapp slot get --slot "$slotname1"` printf "\n4. Create another web app slot %s " "$slotname2" -slot2=`azure webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname2"` +slot2=`az webapp slot create -g "$groupName" --plan "$planName" -n "$appName" --slot "$slotname2"` appWithSlotName2="$appName/$slotname2" printf "\n5. Get the webapp slots:" -slots=`azure webapp slot get -g "$groupName" -n "$appName"` +slots=`az webapp slot get -g "$groupName" -n "$appName"` slotN1=`echo $slots | jq '.[0].name'` slotN2=`echo $slots | jq '.[1].name'` slotNames=`echo $slotN1 $slotN2` @@ -74,7 +74,7 @@ startTime=`date +"%A, %B %d, %Y %X" --date "3 hour ago"` $metricsNames="\"('CPU', 'Requests')\"" # !Not able to test since complex object issue. -metrics=`azure webapp slot metrics get -g "$groupName" -n "$appName" --slot "$slotname1" --granularity PT1M --starttime "$startTime" --endtime "$endTime" --metrics "$metricsNames"` +metrics=`az webapp slot metrics get -g "$groupName" -n "$appName" --slot "$slotname1" --granularity PT1M --starttime "$startTime" --endtime "$endTime" --metrics "$metricsNames"` printf "\nValidating web app slot metrics %s " "$slotname1" for i in $metricsNames @@ -86,57 +86,57 @@ done printf "\nValidating web app slot metrics via pipline obj %s " "$slotname1" printf "\n12. Stop web app slot: %s." "$slotname1" -slot1=`echo "$slot1" | azure webapp slot stop` +slot1=`echo "$slot1" | az webapp slot stop` printf "\nValidating web app slot %s stopped " "$slotname1" [ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Stopped" ] printf "\n13 Stop web app slot: %s." "$slotname1" -slot1=`echo "$slot1" | azure webapp slot start` +slot1=`echo "$slot1" | az webapp slot start` printf "\nValidating web app slot %s running " "$slotname1" [ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ] printf "\n14 Stop web app slot: %s." "$slotname1" -slot1=`echo "$slot1" | azure webapp slot stop` +slot1=`echo "$slot1" | az webapp slot stop` printf "\nValidating web app slot %s stopped " "$slotname1" [ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Stopped" ] printf "\n15 Stop web app slot: %s." "$slotname1" -slot1=`echo "$slot1" | azure webapp slot start` +slot1=`echo "$slot1" | az webapp slot start` printf "\nValidating web app slot %s running " "$slotname1" [ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ] printf "\n16 Restart web app slot: %s." "$slotname1" -slot1=`echo "$slot1" | azure webapp slot restart` +slot1=`echo "$slot1" | az webapp slot restart` printf "\nValidating web app slot %s Running " "$slotname1" [ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ] printf "\n17 Restart web app slot: %s." "$slotname1" -slot1=`echo "$slot1" | azure webapp slot restart` +slot1=`echo "$slot1" | az webapp slot restart` printf "\nValidating web app slot %s Running " "$slotname1" [ $(echo $slot1 | jq '."properties.state"' --raw-output) == "Running" ] # Clone ------ # !Not able to test since complex object input issue. # printf "\n10. Clone web app slot: %s." "$slotname1" -# slotClone=`azure web app slot clone` +# slotClone=`az web app slot clone` # appWithSlotNameClone="$appName/slotname1" # printf "\nValidating cloned web app slot %s " "$slotname1" # [ $(echo $slotClone | jq '.name' --raw-output) == "$appWithSlotNameClone" ] # printf "\nValidating web app slot get for %s " "$slotname1" -# slot1=`azure webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"` +# slot1=`az webapp slot get -g "$groupName" -n "$appName" --slot "$slotname1"` # [ $(echo $slot1 | jq '.name' --raw-output) == "$appWithSlotNameClone" ] #------- # Cleanup printf "\n20. Remove web app slot: %s." "$slotname1" -azure webapp slot remove -g "$groupName" -n "$appName" --slot "$slotname1" +az webapp slot remove -g "$groupName" -n "$appName" --slot "$slotname1" printf "\n20. Remove web app: %s." "$appName" -azure webapp remove -g "$groupName" -n "$appName" +az webapp remove -g "$groupName" -n "$appName" printf "\n20. Remove app service plan: %s." "$planName" -azure app service plan remove -g "$groupName" -n "$planName" +az app service plan remove -g "$groupName" -n "$planName" printf "\n20. Remove resource group: %s." "$groupName" \ No newline at end of file diff --git a/examples/webapp-management/03-WebApp.sh b/examples/webapp-management/03-WebApp.sh index 7f35ff0babfe..2bc2fdbd7e16 100644 --- a/examples/webapp-management/03-WebApp.sh +++ b/examples/webapp-management/03-WebApp.sh @@ -2,7 +2,7 @@ printf "\n=== Managing Web Apps in Azure ===\n" printf "\nSetup: Creating a new resource group: %s at location: %s.\n" "$groupName" "$location" -azure group create --name "$groupName" --location "$location" +az group create --name "$groupName" --location "$location" appName1=`randomName testweb` appName2=`randomName testweb` @@ -19,56 +19,56 @@ tier2="Standard" tier3="Premium" printf "\nSetup: Creating a new app service plan: %s under resource group: %s.\n" "$planName1" "$groupName" -serverFarm=`azure app service plan create -n "$planName1" -g "$groupName" -l "$location" --tier "$tier1"` +serverFarm=`az app service plan create -n "$planName1" -g "$groupName" -l "$location" --tier "$tier1"` printf "\n1: Creating a new webapp: %s under resource group: %s.\n" "$appName1" "$groupName" -actual1=`azure webapp create -g "$groupName" -l "$location" -n "$appName1" --plan "$planName1"` +actual1=`az webapp create -g "$groupName" -l "$location" -n "$appName1" --plan "$planName1"` printf "\n2: Getting info about webapp: %s.\n" "$appName1" -result=`azure webapp get -g "$groupName" -n "$appName1"` +result=`az webapp get -g "$groupName" -n "$appName1"` [ $(echo $result | jq '.Name' --raw-output) == "$appName1" ] [ $(echo $result | jq '.serverFarmId' --raw-output) == $(echo $serverFarm | jq '.id' --raw-output) ] printf "\n3: Creating a new webapp: %s under resource group: %s.\n" "$appName2" "$groupName" -actual2=`azure webapp create -g "$groupName" -l "$location" -n "$appName2" --plan "$planName1"` +actual2=`az webapp create -g "$groupName" -l "$location" -n "$appName2" --plan "$planName1"` [ $(echo $actual2 | jq '.name' --raw-output) == "$appName2" ] [ $(echo $actual2 | jq '."properties.serverFarmId"' --raw-output) == $(echo $serverFarm | jq '.id' --raw-output) ] printf "\n4: Get WebApp by ResourceGroup: %s.\n" "$groupName" -count=`azure webapp get -g "$groupName"` +count=`az webapp get -g "$groupName"` [ $(echo $count | jq -s '. | length') -eq 2 ] printf "\n5: Get WebApp by App Plan :%s.\n" "$planName1" -count=`azure webapp get --plan "$serverFarm"` +count=`az webapp get --plan "$serverFarm"` [ $(echo $count | jq -s '. | length') -eq 2 ] printf "\n6: Get WebApp by location :%s.\n" "$location" -count=`azure webapp get -l "$location"` +count=`az webapp get -l "$location"` [ $(echo $count | jq -s '. | length') -ge 2 ] printf "\n7: Get WebApp under the current subscription.\n" -count=`azure webapp get` +count=`az webapp get` [ $(echo $count | jq -s '. | length') -ge 2 ] printf "\n8: Get WebApp metrics ['CPU', 'Requests'] for webapp: %s" "$appName1" start=`date +"%Y-%m-%dT%H:%M:%SZ"` -metricsInfo=`azure webapp metrics get -g "$groupName" -n "$appName1" --starttime "$start" --granularity PT1M --metrics "[\"CPU\", \"Requests\"]"` +metricsInfo=`az webapp metrics get -g "$groupName" -n "$appName1" --starttime "$start" --granularity PT1M --metrics "[\"CPU\", \"Requests\"]"` [ $(echo $metricsInfo | jq -s '. | length') -eq 2 ] [ $(echo $metricsInfo | jq -sr '. [0].name.value') == "Requests" ] || [ $(echo $metricsInfo | jq -sr '. [0].name.value') == "CPU" ] [ $(echo $metricsInfo | jq -sr '. [1].name.value') == "CPU" ] || [ $(echo $metricsInfo | jq -sr '. [1].name.value') == "Requests" ] printf "\n9: Creating a new app service plan: %s under resource group: %s.\n" "$planName2" "$groupName" -serverFarm2=`azure app service plan create -n "$planName2" -g "$groupName" -l "$location" --tier "$tier2"` +serverFarm2=`az app service plan create -n "$planName2" -g "$groupName" -l "$location" --tier "$tier2"` printf "\n10: Change webapp: %s to new service plan: %s\n" "$appName2" "$planName2" -changePlan=`azure webapp set -g "$groupName" -n $appName2 --plan $planName2` +changePlan=`az webapp set -g "$groupName" -n $appName2 --plan $planName2` [ $(echo $changePlan | jq '.name' --raw-output) == "$appName2" ] [ $(echo $changePlan | jq '."properties.serverFarmId"' --raw-output) == $(echo $serverFarm2 | jq '.id' --raw-output) ] printf "\n11: Set config properties 'httpLoggingEnabled' & 'requestTracingEnabled' of the webapp: %s to true.\n" "$appName2" changePlan=`echo $changePlan | jq '."properties.siteConfig"."properties.httpLoggingEnabled"'=true` changePlan=`echo $changePlan | jq '."properties.siteConfig"."properties.requestTracingEnabled"'=true` -changePlan=`echo $changePlan | azure webapp set` +changePlan=`echo $changePlan | az webapp set` [ $(echo $changePlan | jq '.name' --raw-output) == "$appName2" ] [ $(echo $changePlan | jq '."properties.serverFarmId"' --raw-output) == $(echo $serverFarm2 | jq '.id' --raw-output) ] [ $(echo $changePlan | jq '."properties.siteConfig"."properties.httpLoggingEnabled"' --raw-output) == true ] @@ -78,7 +78,7 @@ printf "\n12: Set appsettings and connectionstrings of the webapp: %s.\n" "$appN appsettings="{\"setting1\":\"valueA\",\"setting2\":\"valueB\"}" constr="{ \"connstring1\": { \"Type\": \"MySql\", \"Value\": \"string value 1\" }, \"connstring2\": { \"Type\": \"SqlAzure\", \"Value\": \"string value 2\" } }" -setconn=`azure webapp set -g "$groupName" -n "$appName2" --appsettings "$appsettings" --connectionstrings "$constr"` +setconn=`az webapp set -g "$groupName" -n "$appName2" --appsettings "$appsettings" --connectionstrings "$constr"` [ $(echo $setconn | jq '.name' --raw-output) == "$appName2" ] [ $(echo $setconn | jq '."properties.siteConfig"."properties.appSettings" | length') -eq 2 ] [ $(echo $setconn | jq '."properties.siteConfig"."properties.connectionStrings" | length') -eq 2 ] @@ -98,89 +98,89 @@ conexn=`echo $setconn | jq -r '."properties.siteConfig"."properties.connectionSt [ $(echo $conexn | jq -r '.[1].type') == "SQLAzure" ] printf "\n13: Stop the webapp: %s.\n" "$appName2" -stop=`azure webapp stop -g "$groupName" -n "$appName2"` +stop=`az webapp stop -g "$groupName" -n "$appName2"` [ $(echo $stop | jq '.name' --raw-output) == "$appName2" ] [ $(echo $stop | jq '."properties.state"' --raw-output) == "Stopped" ] printf "\n14: Start the webapp: %s.\n" "$appName2" -start=`azure webapp start -g "$groupName" -n "$appName2"` +start=`az webapp start -g "$groupName" -n "$appName2"` [ $(echo $start | jq '.name' --raw-output) == "$appName2" ] [ $(echo $start | jq '."properties.state"' --raw-output) == "Running" ] printf "\n15: Stop the webapp: %s again.\n" "$appName2" -stop=`azure webapp stop -g "$groupName" -n "$appName2"` +stop=`az webapp stop -g "$groupName" -n "$appName2"` [ $(echo $stop | jq '.name' --raw-output) == "$appName2" ] [ $(echo $stop | jq '."properties.state"' --raw-output) == "Stopped" ] printf "\n16: Start the webapp: %s again.\n" "$appName2" -start=`azure webapp start -g "$groupName" -n "$appName2"` +start=`az webapp start -g "$groupName" -n "$appName2"` [ $(echo $start | jq '.name' --raw-output) == "$appName2" ] [ $(echo $start | jq '."properties.state"' --raw-output) == "Running" ] printf "\n17: Restart the webapp: %s.\n" "$appName2" -start=`azure webapp restart -g "$groupName" -n "$appName2"` +start=`az webapp restart -g "$groupName" -n "$appName2"` [ $(echo $start | jq '.name' --raw-output) == "$appName2" ] [ $(echo $start | jq '."properties.state"' --raw-output) == "Running" ] printf "\n18: Creating a new app service plan: %s under resource group: %s with Premium tier.\n" "$planName3" "$groupName" -serverFarm3=`azure app service plan create -n "$planName3" -g "$groupName" -l "$location" --tier "$tier3"` +serverFarm3=`az app service plan create -n "$planName3" -g "$groupName" -l "$location" --tier "$tier3"` [ $(echo $serverFarm3 | jq '.name' --raw-output) == "$planName3" ] printf "\n19: Changing plan: %s to Premium tier.\n" "$planName1" -plan1set=`azure app service plan set -n "$planName1" -g "$groupName" --tier "$tier3"` +plan1set=`az app service plan set -n "$planName1" -g "$groupName" --tier "$tier3"` [ $(echo $plan1set | jq '.sku.tier' --raw-output) == "$tier3" ] printf "\n20: Cloning a new webapp: %s from an existing webapp: %s.\n" "$appName3" "$appName1" -clone=`azure webapp create -g "$groupName" -l "$location" -n "$appName3" --plan "$planName3" --sourcewebapp "$actual1"` +clone=`az webapp create -g "$groupName" -l "$location" -n "$appName3" --plan "$planName3" --sourcewebapp "$actual1"` [ $(echo $clone | jq '.name' --raw-output) == "$appName3" ] printf "\n21: Get the newly created webapp: %s.\n" "$appName3" -result3=`azure webapp get -g "$groupName" -n "$appName3"` +result3=`az webapp get -g "$groupName" -n "$appName3"` [ $(echo $result3 | jq '.name' --raw-output) == "$appName3" ] #Need to ask the webapp team about the creation of traffic manager profile #printf "\n22: Creating a new app service plan: %s under resource group: %s with Premium tier.\n" "$planName4" "$groupName" -#serverFarm4=`azure app service plan create -n "$planName4" -g "$groupName" -l "$location" --tier "$tier3"` +#serverFarm4=`az app service plan create -n "$planName4" -g "$groupName" -l "$location" --tier "$tier3"` #[ $(echo $serverFarm4 | jq '.name' --raw-output) == "$planName4" ] #profileName=`randomName profile` #printf "\n23: Cloning a new webapp: %s from an existing webapp: %s with traffic manager profile: %s.\n" "$appName4" "$appName3" "$profileName" -#cloneTraffic=`azure webapp create -g "$groupName" -l "$location" -n "$appName4" --plan "$planName4" --sourcewebapp "$clone" --trafficmanagerprofilename "$profileName"` +#cloneTraffic=`az webapp create -g "$groupName" -l "$location" -n "$appName4" --plan "$planName4" --sourcewebapp "$clone" --trafficmanagerprofilename "$profileName"` #[ $(echo $cloneTraffic | jq '.name' --raw-output) == "$appName4" ] #printf "\n24: Get the newly created webapp: %s.\n" "$appName4" -#result4=`azure webapp get -g "$groupName" -n "$appName4"` +#result4=`az webapp get -g "$groupName" -n "$appName4"` #[ $(echo $result4 | jq '.name' --raw-output) == "$appName4" ] filename=`randomName pf` filename+=".xml" printf "\n25: Get the publish profile for webapp: %s and save it to %s file\n." "$appName3" "$filename" -pubprof=`azure webapp profile get -g "$groupName" -n "$appName3" --outputfile "$filename"` +pubprof=`az webapp profile get -g "$groupName" -n "$appName3" --outputfile "$filename"` [ -e "$filename" ] [ -s "$filename" ] printf "\n26: Reset the publish profile for webapp: %s.\n" "$appName3" -azure webapp profile reset -g "$groupName" -n "$appName3" +az webapp profile reset -g "$groupName" -n "$appName3" filename2=`randomName pf` filename2+=".xml" printf "\n27: Get the publish profile for webapp: %s after resetting and save it to %s file\n." "$appName3" "$filename2" -pubprof2=`azure webapp profile get -g "$groupName" -n "$appName3" --outputfile "$filename2"` +pubprof2=`az webapp profile get -g "$groupName" -n "$appName3" --outputfile "$filename2"` [ -e "$filename2" ] [ -s "$filename2" ] filename3=`randomName pf` filename3+=".xml" printf "\n28: Get the publish profile for webapp: %s in format FileZilla3 and save it to %s file\n." "$appName3" "$filename3" -azure webapp profile get -g "$groupName" -n "$appName3" --outputfile "$filename3" --format "FileZilla3" +az webapp profile get -g "$groupName" -n "$appName3" --outputfile "$filename3" --format "FileZilla3" [ -e "$filename3" ] [ -s "$filename3" ] printf "\n29:Remove created webapps: %s, %s, %s, %s.\n" "$appName1" "$appName2" "$appName3" "$appName4" -azure webapp remove -g "$groupName" -n "$appName1" -f -azure webapp remove -g "$groupName" -n "$appName2" -f -azure webapp remove -g "$groupName" -n "$appName3" -f -#azure webapp remove -g "$groupName" -n "$appName4" -f +az webapp remove -g "$groupName" -n "$appName1" -f +az webapp remove -g "$groupName" -n "$appName2" -f +az webapp remove -g "$groupName" -n "$appName3" -f +#az webapp remove -g "$groupName" -n "$appName4" -f printf "\n30:Remove the resource group: %s.\n" "$groupName" -deleterg=`azure group remove -n "$groupName" --force` +deleterg=`az group remove -n "$groupName" --force`