Skip to content

Commit 247fd5e

Browse files
committed
Merge pull request #343 from Azure/clu
Clu
2 parents 8287585 + 68d9ad4 commit 247fd5e

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

examples/compute-management/02-VirtualMachineCreation.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName"
66
az resource group create -n "$groupName" --location "$location"
77

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

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

1414
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

20-
printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnetId='$subnetId'.\n" "$subId"
20+
printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnet='$subnetId'.\n" "$subId"
2121
export MSYS_NO_PATHCONV=1
22-
az vnet create--name test --resourcegroupname "$groupName" --location "$location" --subnetid "$subnetId"
22+
az network interface create --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"
@@ -28,9 +28,8 @@ vhdUri="https://$storageAccountName.blob.core.windows.net/$storageAccountName/$s
2828

2929
vmStr="{\"Name\":\"test\",\"HardwareProfile\":{\"VmSize\":\"Standard_A1\"},\"NetworkProfile\":{\"NetworkInterfaces\":[{\"Id\":\"$nicId\"}]},\"OSProfile\":{\"ComputerName\":\"test\",\"AdminPassword\":\"BaR@1234\",\"AdminUsername\":\"Foo12\"},\"StorageProfile\":{\"ImageReference\":{\"Offer\":\"WindowsServer\",\"Publisher\":\"MicrosoftWindowsServer\",\"Sku\":\"2008-R2-SP1\",\"Version\":\"latest\"},\"OSDisk\":{\"Caching\":\"ReadWrite\",\"CreateOption\":\"FromImage\",\"Name\":\"osDisk\",\"Vhd\":{\"Uri\":\"$vhdUri\"}}}}"
3030

31-
printf "\n5. Create virtual machine with\r\nnicId='%s'\r\nvhdUri='%s'\r\nvmStr='%s'\n" "$nicId" "$vhdUri" "$vmStr"
32-
33-
az vm create--resourcegroupname "$groupName" --location "$location" --vmprofile "$vmStr"
31+
printf "\n5. Create virtual machine with\r\nnicId='%s'\r\nvhdUri='$vhdUri'\r\nvmStr='$vmStr'\n" "$nicId"
32+
az vm create --resourcegroupname "$groupName" --location "$location" --vmprofile "$vmStr"
3433

3534
printf "\n6. Removing resource group: %s.\n" "$groupName"
3635
az resource group rm -n "$groupName" -f

examples/resource-management/02-Resource.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ printf "\n7. Move Resource to resource group: %s.\n" "$destinationGroupName"
3535
az resource group create --name "$destinationGroupName" --location "$location"
3636
resourceId=$(echo $resourceInfo | jq '.ResourceId')
3737
arrayId="[$resourceId]"
38-
az resource move -g "$destinationGroupName" --ResourceId "$arrayId" -f
38+
az resource mv -g "$destinationGroupName" --ResourceId "$arrayId" -f
3939

4040
printf "\n8. Removing resource: %s.\n" "$resourceName"
4141
foundResource=$(az resource find -n "$resourceName" -t $resourceType)

examples/resource-management/04-RoleAssignments.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ az resource 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 ls)
10+
users=$(az ad user ls)
1111
userId=$(echo $users | cat | jq '.[0].Id' -s --raw-output)
1212
echo "UserID: $userId"
1313
roleDefinitions=$(az resource role definition ls)

examples/resource-management/roleDefinition.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"Microsoft.Support/*"
77
],
88
"NotActions": [],
9-
"AssignableScopes": [ "/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6" ]
9+
"AssignableScopes": [ "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590" ]
1010
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ public void DeploymentsTest()
5454
[Fact]
5555
public void RoleAssignmentsTest()
5656
{
57+
// Must login as a user due to restricted use of old graph api
5758
var helper = _collectionState
58-
.LoginAsService()
59+
.LoginAsUser()
5960
.GetRunner("resource-management")
6061
.RunScript("04-RoleAssignments");
6162
}
@@ -64,7 +65,6 @@ public void RoleAssignmentsTest()
6465
public void RoleDefinitionsTest()
6566
{
6667
var helper = _collectionState
67-
.LoginAsService()
6868
.GetRunner("resource-management")
6969
.RunScript("05-RoleDefinitions");
7070
}

0 commit comments

Comments
 (0)