Skip to content

Commit ced0209

Browse files
committed
Merge branch 'clu' of https://github.com/Azure/azure-powershell into clu
# Conflicts: # src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs # src/CLU/Microsoft.Azure.Commands.Compute/Extension/CustomScript/RemoveAzureVMCustomScriptExtensionCommand.cs # src/CLU/Microsoft.Azure.Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs # src/CLU/Microsoft.Azure.Commands.Compute/Extension/VMAccess/RemoveAzureVMAccessExtension.cs # src/CLU/Microsoft.Azure.Commands.Compute/Extension/VMAccess/SetAzureVMAccessExtension.cs # src/CLU/Microsoft.Azure.Commands.Compute/VirtualMachine/Action/SetAzureVMCommand.cs # src/CLU/Microsoft.Azure.Commands.Compute/VirtualMachine/Action/StartAzureVMCommand.cs # src/CLU/Microsoft.Azure.Commands.Compute/VirtualMachine/Action/StopAzureVMCommand.cs
2 parents 2f96680 + ba03791 commit ced0209

File tree

321 files changed

+495
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+495
-184
lines changed

examples/compute-management/01-VirtualMachineSizes.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ set -e
33
printf "\n=== Managing Virtual Machine Sizes in Azure Compute ===\n"
44

55
printf "\n1. Showing VM size results in location: %s.\n" "$location"
6-
az vmsize get --location "$location"
6+
az vm size ls --location "$location"
77

88
printf "\n2. Checking VM size results in location: %s.\n" "$location"
9-
vmSizeResult=`az vmsize get --location "$location"`
9+
vmSizeResult=`az vm size ls --location "$location"`
1010

1111
if [[ $vmSizeResult == "" ]]; then
1212
echo "Failure: No VM sizes!" 1>&2
@@ -15,23 +15,23 @@ else
1515
echo "Success: Non-empty Results."
1616
fi
1717

18-
filterResult=`az vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_A0"))' --raw-output`
18+
filterResult=`az vm size ls --location "$location" | cat | jq 'select(.name | contains("Standard_A0"))' --raw-output`
1919
if [[ "$filterResult" == "" ]]; then
2020
echo "Failure: Standard_A0 vm size not found." 1>&2
2121
exit 1
2222
else
2323
echo "Success: Standard_A0 vm size found."
2424
fi
2525

26-
filterResult=`az vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_G1"))' --raw-output`
26+
filterResult=`az vm size ls --location "$location" | cat | jq 'select(.name | contains("Standard_G1"))' --raw-output`
2727
if [[ "$filterResult" == "" ]]; then
2828
echo "Failure: Standard_G1 vm size not found." 1>&2
2929
exit 1
3030
else
3131
echo "Success: Standard_G1 vm size found."
3232
fi
3333

34-
filterResult=`az vmsize get --location "$location" | cat | jq 'select(.name | contains("NonStandard_A1"))' --raw-output`
34+
filterResult=`az vm size ls --location "$location" | cat | jq 'select(.name | contains("NonStandard_A1"))' --raw-output`
3535
if [[ "$filterResult" == "" ]]; then
3636
echo "Success: NonStandard_A1 vm size not found."
3737
else

examples/compute-management/02-VirtualMachineCreation.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ set -e
33
printf "\n=== Managing Virtual Machine Creation in Azure Compute ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create -n "$groupName" --location "$location"
6+
az resourcemanager group create -n "$groupName" --location "$location"
77

88
printf "\n2. Creating a new storage account '%s' in type '%s'.\n" "$storageAccountName" "$storageAccountType"
99
az storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType"
1010

1111
printf "\n3. Create virtual network.\n"
12-
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`
12+
result=`az vnet new --resourcegroupname "$groupName" --name test --location "$location" --addressprefix "[\"10.0.0.0/16\"]" --subnet "[{\"Name\":\"test\",\"AddressPrefix\":\"10.0.0.0/24\"}]" --force`
1313

14-
contextResult=`az context get`
14+
contextResult=`az context ls`
1515

1616
subId=`echo $contextResult | jq '.Subscription.SubscriptionId' --raw-output`
1717

1818
subnetId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Network/virtualNetworks/test/subnets/test"
1919

2020
printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnetId='$subnetId'.\n" "$subId"
2121
export MSYS_NO_PATHCONV=1
22-
az network interface new --name test --resourcegroupname "$groupName" --location "$location" --subnetid "$subnetId"
22+
az networkinterface new --name test --resourcegroupname "$groupName" --location "$location" --subnetid "$subnetId"
2323
export MSYS_NO_PATHCONV=
2424

2525
nicId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Network/networkInterfaces/test"
@@ -33,4 +33,4 @@ printf "\n5. Create virtual machine with\r\nnicId='%s'\r\nvhdUri='%s'\r\nvmStr='
3333
az vm new --resourcegroupname "$groupName" --location "$location" --vmprofile "$vmStr"
3434

3535
printf "\n6. Removing resource group: %s.\n" "$groupName"
36-
az group remove -n "$groupName" -f
36+
az resourcemanager group rm -n "$groupName" -f

examples/lib/testrunner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ for d in $( ls $TESTDIR/.. --ignore=lib ); do
1515
. $f
1616
set +e
1717
printf "\nCleanup: removing resource group: %s\n" $groupName
18-
az group remove --name "$groupName" --force
18+
az resourcemanager group rm --name "$groupName" --force
1919
set -e
2020
echo "success: $f"
2121
done

examples/resource-management/01-ResourceGroups.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ set -e
33
printf "\n=== Managing Resource Groups in Azure ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create -n "$groupName" --location "$location"
6+
az resourcemanager group create -n "$groupName" --location "$location"
77

88
printf "\n2. Updating the group %s with tags.\n" "$groupName"
9-
az group set -n "$groupName" --tags "[{\"Value\":\"testval\",\"Name\":\"testtag\"}]"
9+
az resourcemanager group set -n "$groupName" --tags "[{\"Value\":\"testval\",\"Name\":\"testtag\"}]"
1010

1111
printf "\n3. Get information about resource group : %s.\n" "$groupName"
12-
resourceGroupInfo=`az group get -n $groupName`
12+
resourceGroupInfo=`az resourcemanager group ls -n $groupName`
1313

1414
printf "\nValidating resource group name is: %s\n" "$groupName"
1515
[ $(echo $resourceGroupInfo | jq '.ResourceGroupName' --raw-output) == "$groupName" ]
1616

1717
printf "\n4. Listing all resource groups in the subscription.\n"
18-
az group get
18+
az resourcemanager group ls
1919

2020
printf "\n5. Removing resource group: %s.\n" "$groupName"
21-
az group remove -n "$groupName" -f
21+
az resourcemanager group rm -n "$groupName" -f

examples/resource-management/02-Resource.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,44 @@ set -e
33
printf "\n=== Managing Resources in Azure ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create --name "$groupName" --location "$location"
6+
az resourcemanager group create --name "$groupName" --location "$location"
77
destinationGroupName=$groupName"Destination"
88

99
printf "\n2. Registering Resource Provider Namespace.\n"
1010
providerNamespace="Providers.Test"
11-
az resource provider register --ProviderNamespace $providerNamespace --Force
11+
az resourcemanager resource resourcemanager provider register --ProviderNamespace $providerNamespace --Force
1212

1313
printf "\n3. Creating a new Resource: %s.\n" "$resourceName"
1414
resourceType="$providerNamespace/statefulResources"
1515
tags='[{"Name": "testtag", "Value": "testvalue"}]'
1616
properties='{"administratorLogin": "adminuser", "administratorLoginPassword": "P@ssword1"}'
1717
apiversion="2014-04-01"
18-
az resource create --Name $resourceName --Location $location --Tags "$tags" --ResourceGroupName $groupName --ResourceType $resourceType --PropertyObject "$properties" --ApiVersion $apiversion --Force
18+
az resourcemanager resource create --Name $resourceName --Location $location --Tags "$tags" --ResourceGroupName $groupName --ResourceType $resourceType --PropertyObject "$properties" --ApiVersion $apiversion --Force
1919

2020
printf "\n4. Get information about Resource : %s.\n" "$resourceName"
21-
resourceInfo=$(az resource get -n $resourceName)
21+
resourceInfo=$(az resourcemanager resource ls -n $resourceName)
2222
printf "\nValidating Resource name is: %s\n" "$resourceName"
2323
[ $(echo $resourceInfo | jq '.Name' --raw-output) == "$resourceName" ]
2424

2525
printf "\n5. Find Resource with name '%s' and type '%s'.\n" "$resourceName" "$resourceType"
26-
foundResource=$(az resource find -n "$resourceName" -t $resourceType)
26+
foundResource=$(az resourcemanager resource find -n "$resourceName" -t $resourceType)
2727
printf "\nValidating Resource name is: %s.\n" "$resourceName"
2828
[ $(echo $foundResource | jq '.Name' --raw-output) == "$resourceName" ]
2929

3030
printf "\n6. Update Resource.\n"
3131
tagsUpdate='[{"Name": "testtagUpdated", "Value": "testvalueUpdated"}]'
32-
az resource set --ResourceGroupName $groupName --ResourceName $resourceName --ResourceType $resourceType --Tags "$tagsUpdate" -f
32+
az resourcemanager resource set --ResourceGroupName $groupName --ResourceName $resourceName --ResourceType $resourceType --Tags "$tagsUpdate" -f
3333

3434
printf "\n7. Move Resource to resource group: %s.\n" "$destinationGroupName"
35-
az group create --name "$destinationGroupName" --location "$location"
35+
az resourcemanager group create --name "$destinationGroupName" --location "$location"
3636
resourceId=$(echo $resourceInfo | jq '.Id')
3737
arrayId="[$resourceId]"
38-
az resource move -g "$destinationGroupName" --ResourceId "$arrayId" -f
38+
az resourcemanager resource move -g "$destinationGroupName" --ResourceId "$arrayId" -f
3939

4040
printf "\n8. Removing resource: %s.\n" "$resourceName"
41-
foundResource=$(az resource find -n "$resourceName" -t $resourceType)
41+
foundResource=$(az resourcemanager resource find -n "$resourceName" -t $resourceType)
4242
resourceId=$(echo $foundResource | jq '.Id' --raw-output)
4343
echo $resourceId
4444
export MSYS_NO_PATHCONV=1
45-
az resource remove --Id "$resourceId" -f
45+
az resourcemanager resource rm --Id "$resourceId" -f
4646
export MSYS_NO_PATHCONV=

examples/resource-management/03-Deployments.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ set -e
33
printf "\n=== Provisioning Deployments in Azure ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create --name "$groupName" --location "$location"
6+
az resourcemanager group create --name "$groupName" --location "$location"
77

88
printf "\n2. Test template with dynamic parameters\n"
9-
az group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --siteName "$resourceName" --hostingPlanName "$resourceName" --siteLocation "$location" --workerSize "0"
9+
az resourcemanager group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --siteName "$resourceName" --hostingPlanName "$resourceName" --siteLocation "$location" --workerSize "0"
1010

1111
printf "\n3. Test template with JSON parameter object\n"
12-
az group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --templateparameterobject "{\"siteName\":\"$resourceName\",\"hostingPlanName\":\"$resourceName\",\"siteLocation\":\"$location\",\"workerSize\": 0 }"
12+
az resourcemanager group deployment test -g "$groupName" --templatefile $BASEDIR/sampleTemplate.json --templateparameterobject "{\"siteName\":\"$resourceName\",\"hostingPlanName\":\"$resourceName\",\"siteLocation\":\"$location\",\"workerSize\": 0 }"
1313

1414
printf "\n4. Provisioning Deployment\n"
15-
deploymentInfo=`az group deployment create --Name "$resourceName" --ResourceGroupName "$groupName" --TemplateFile $BASEDIR/sampleTemplate.json --TemplateParameterFile $BASEDIR/sampleTemplateParams.json`
15+
deploymentInfo=`az resourcemanager group deployment create --Name "$resourceName" --ResourceGroupName "$groupName" --TemplateFile $BASEDIR/sampleTemplate.json --TemplateParameterFile $BASEDIR/sampleTemplateParams.json`
1616
echo $deploymentInfo

examples/resource-management/04-RoleAssignments.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ set -e
33
printf "\n=== Managing Role Assignments in Azure ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create --name "$groupName" --location "$location"
6+
az resourcemanager group create --name "$groupName" --location "$location"
77

88
printf "\n2. Creating a new Role Assignment.\n"
99
export MSYS_NO_PATHCONV=1
10-
users=$(az ad users get)
10+
users=$(az activedirectory users ls)
1111
userId=$(echo $users | cat | jq '.[0].Id' -s --raw-output)
1212
echo "UserID: $userId"
13-
roleDefinitions=$(az role definition get)
13+
roleDefinitions=$(az networksecurityrole definition ls)
1414
roleDefinitionId=$(echo $roleDefinitions | cat | jq '.[0].Id' -s --raw-output)
1515
echo "RoleDefinitionId: $roleDefinitionId"
16-
subsciptions=$(az subscription get)
16+
subsciptions=$(az subscription ls)
1717
subscriptionId=$(echo $subsciptions | cat | jq '.[0].SubscriptionId' -s --raw-output)
1818
scope="/subscriptions/$subscriptionId/resourceGroups/$groupName"
1919
echo "Scope: $scope"
20-
az role assignment create --ObjectId "$userId" --RoleDefinitionId "$roleDefinitionId" --Scope "$scope"
20+
az networksecurityrole assignment create --ObjectId "$userId" --RoleDefinitionId "$roleDefinitionId" --Scope "$scope"
2121

2222
printf "\n3. Delete last created Role Assignment.\n"
23-
assignments=$(az role assignment get)
23+
assignments=$(az networksecurityrole assignment ls)
2424
assignmentId=$(echo $assignments | cat | jq '.[-1:][0].ObjectId' -s --raw-output)
2525
echo "Deleting assignment: $assignmentId"
26-
az role assignment remove --ObjectId "$assignmentId" --Scope "$scope" --RoleDefinitionId "$roleDefinitionId" -f
26+
az networksecurityrole assignment rm --ObjectId "$assignmentId" --Scope "$scope" --RoleDefinitionId "$roleDefinitionId" -f
2727
export MSYS_NO_PATHCONV=

examples/resource-management/05-RoleDefinitions.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ set -e
33
printf "\n=== Managing Role Definitions in Azure ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create --name "$groupName" --location "$location"
6+
az resourcemanager group create --name "$groupName" --location "$location"
77

88
printf "\n2. Creating a new Role Definition.\n"
9-
roleDefinition=$(az role definition create --inputfile $BASEDIR/roleDefinition.json)
9+
roleDefinition=$(az networksecurityrole definition create --inputfile $BASEDIR/roleDefinition.json)
1010

1111
printf "\n3. Get information about Role Definitions.\n"
1212
roleDefinitionName=$(echo $roleDefinition | jq '.Name' --raw-output)
13-
az role definition get -n $roleDefinitionName
13+
az networksecurityrole definition ls -n $roleDefinitionName
1414

1515
printf "\n4. Update Role Definition.\n"
1616
export MSYS_NO_PATHCONV=1
1717
updatedRoleDefinition=$(echo $roleDefinition | jq '.Actions |= .+ ["Microsoft.Authorization/*/write"]')
18-
az role definition set --Role "$updatedRoleDefinition"
18+
az networksecurityrole definition set --Role "$updatedRoleDefinition"
1919

2020
printf "\n5. Delete Role Definition.\n"
2121
roleDefinitionId=$(echo $roleDefinition | jq '.Id' --raw-output)
22-
az role definition remove --Id $roleDefinitionId --PassThru -f
22+
az networksecurityrole definition rm --Id $roleDefinitionId --PassThru -f
2323
export MSYS_NO_PATHCONV=

examples/virtual-hard-disk/01-VirtualHardDisks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33
printf "\n=== Managing Virtual Hard Disks in Azure Compute ===\n"
44

55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6-
az group create -n "$groupName" --location "$location"
6+
az resourcemanager group create -n "$groupName" --location "$location"
77

88
printf "\n2. Creating a new storage account '%s' in type '%s'.\n" "$storageAccountName" "$storageAccountType"
99
az storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType"
@@ -25,4 +25,4 @@ else
2525
fi
2626

2727
printf "\n6. Removing resource group: %s.\n" "$groupName"
28-
az group remove -n "$groupName" -f
28+
az resourcemanager group rm -n "$groupName" -f

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-
az group create --name "$groupName" --location "$location"
12+
az resourcemanager group create --name "$groupName" --location "$location"
1313

1414
printf "\n1. Create a new app service plan %s " "$whpName"
15-
az app service plan create -n "$whpName" -g "$groupName" -l "$location" --tier "$tier" --size "$size" --workers "$capacity"
15+
az appservice 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=`az app service plan get --name $whpName --group $groupName`
18+
whpInfo=`az appservice plan ls --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=`az app service plan set -n $whpName -g $groupName --tier $newTier --workers --workers $newCapacity --size $newSize`
31+
setPlanInfo=`az appservice 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=`az app service plan set -n $whpName -g $groupName --tier $newTier -
3838
whpName2=`randomName testplan`
3939
printf "\n4. Creating a new app service plan: %s" "$whpName2"
4040
location2="East US"
41-
az app service plan create -n "$whpName2" -g "$groupName" -l "$location2" --tier "$tier" --size "$size" --workers "$capacity"
41+
az appservice 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=`az app service plan get --name $whpName2`
44+
whpInfo2=`az appservice plan ls --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=`az app service plan get --group $groupName`
52+
plansByGroup=`az appservice plan ls --group $groupName`
5353
[ $plansByGroup == *"$whpName"* ]
5454
[ $plansByGroup == *"$whpName2"* ]
5555

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

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

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

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

0 commit comments

Comments
 (0)