Skip to content

Clu #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 21, 2016
Merged

Clu #343

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions examples/compute-management/02-VirtualMachineCreation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName"
az resource group create -n "$groupName" --location "$location"

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

printf "\n3. Create virtual network.\n"
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`
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`

contextResult=`az context ls`

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

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

printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnetId='$subnetId'.\n" "$subId"
printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnet='$subnetId'.\n" "$subId"
export MSYS_NO_PATHCONV=1
az vnet create--name test --resourcegroupname "$groupName" --location "$location" --subnetid "$subnetId"
az network interface create --name test --resourcegroupname "$groupName" --location "$location" --subnetId "$subnetId"
export MSYS_NO_PATHCONV=

nicId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Network/networkInterfaces/test"
Expand All @@ -28,9 +28,8 @@ vhdUri="https://$storageAccountName.blob.core.windows.net/$storageAccountName/$s

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\"}}}}"

printf "\n5. Create virtual machine with\r\nnicId='%s'\r\nvhdUri='%s'\r\nvmStr='%s'\n" "$nicId" "$vhdUri" "$vmStr"

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

printf "\n6. Removing resource group: %s.\n" "$groupName"
az resource group rm -n "$groupName" -f
2 changes: 1 addition & 1 deletion examples/resource-management/02-Resource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ printf "\n7. Move Resource to resource group: %s.\n" "$destinationGroupName"
az resource group create --name "$destinationGroupName" --location "$location"
resourceId=$(echo $resourceInfo | jq '.ResourceId')
arrayId="[$resourceId]"
az resource move -g "$destinationGroupName" --ResourceId "$arrayId" -f
az resource mv -g "$destinationGroupName" --ResourceId "$arrayId" -f

printf "\n8. Removing resource: %s.\n" "$resourceName"
foundResource=$(az resource find -n "$resourceName" -t $resourceType)
Expand Down
2 changes: 1 addition & 1 deletion examples/resource-management/04-RoleAssignments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ az resource group create --name "$groupName" --location "$location"

printf "\n2. Creating a new Role Assignment.\n"
export MSYS_NO_PATHCONV=1
users=$(az ad users ls)
users=$(az ad user ls)
userId=$(echo $users | cat | jq '.[0].Id' -s --raw-output)
echo "UserID: $userId"
roleDefinitions=$(az resource role definition ls)
Expand Down
2 changes: 1 addition & 1 deletion examples/resource-management/roleDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"Microsoft.Support/*"
],
"NotActions": [],
"AssignableScopes": [ "/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6" ]
"AssignableScopes": [ "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public void DeploymentsTest()
[Fact]
public void RoleAssignmentsTest()
{
// Must login as a user due to restricted use of old graph api
var helper = _collectionState
.LoginAsService()
.LoginAsUser()
.GetRunner("resource-management")
.RunScript("04-RoleAssignments");
}
Expand All @@ -64,7 +65,6 @@ public void RoleAssignmentsTest()
public void RoleDefinitionsTest()
{
var helper = _collectionState
.LoginAsService()
.GetRunner("resource-management")
.RunScript("05-RoleDefinitions");
}
Expand Down