Skip to content

[Experiment][Compute] Tab completion for New-AzVm #4655

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 31 commits into from
Oct 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
42ddd90
some bug fixes
sergey-shandar Sep 21, 2017
4ff5ed7
subnet bug fix
sergey-shandar Sep 21, 2017
a9a144d
Output
sergey-shandar Sep 21, 2017
033e9ab
FQDN
sergey-shandar Sep 21, 2017
ed36568
output
sergey-shandar Sep 21, 2017
67b2613
Merge branch 'experiments' into sergey-compute-output
sergey-shandar Sep 21, 2017
853caa3
progress using Write-Host
sergey-shandar Sep 21, 2017
3c128df
progress
sergey-shandar Sep 21, 2017
cb9649e
progress
sergey-shandar Sep 21, 2017
d1584d0
version update
sergey-shandar Sep 21, 2017
54e3b46
1.0.21
sergey-shandar Sep 21, 2017
0baf915
Progress.
sergey-shandar Sep 21, 2017
a32d0bd
merge from `experiment` branch
sergey-shandar Sep 22, 2017
33f21d5
1.0.22
sergey-shandar Sep 22, 2017
25704b9
1.0.23
sergey-shandar Sep 22, 2017
ec4ce1e
ResourceGroup has to be a direct dependency
sergey-shandar Sep 25, 2017
1a55ed3
clean output
sergey-shandar Sep 25, 2017
967e69d
1.0.26
sergey-shandar Sep 26, 2017
ace90c3
ports
sergey-shandar Oct 4, 2017
fdb48f6
messages
sergey-shandar Oct 4, 2017
4a460c4
minor
sergey-shandar Oct 4, 2017
a4c6057
1.0.27
sergey-shandar Oct 5, 2017
c0bc96b
First Pester Tests.
sergey-shandar Oct 5, 2017
77c0a57
first validation
sergey-shandar Oct 6, 2017
0eefdf8
bug fix
sergey-shandar Oct 6, 2017
274777c
1.0.28
sergey-shandar Oct 6, 2017
193e92c
minor
sergey-shandar Oct 7, 2017
36a51fe
Disable Boot Diagnostics #4735
sergey-shandar Oct 7, 2017
97137e9
-DisableBootDiagnostics
sergey-shandar Oct 7, 2017
b93dbd2
Set-AzureRmVMBootDiagnostics
sergey-shandar Oct 7, 2017
cfbd824
1.0.30
sergey-shandar Oct 9, 2017
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
171 changes: 171 additions & 0 deletions comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Comments

- Local objects.
- Smart cmdlets for
- P2. Resource Group.
- P2. Virtual Network.
- P2. Security Group.
- P2. Resource Ids, a tree structure
- P1. Output for smart commands. In particular, information about (PS information stream ?)
- Resource Group!!!
- Virtual Network!
- Security Group!
- ...!
- Security Rules:
- DefaultSecurityRulesText - can/should we use it?
- P2. information stream
- P3. show progress
- P1. return PowerShell Job (async)

## Tasks

P0 is 09/05/2017

- [ ] P0 output
- [X] P0 create a package (PSM1, PSD1...)
- [X] P0 Manifest with dependencies
- image list
- [X] P0: json file or PSObject
- [ ] P1: json
- [ ] P2: source of image names. CDN, Azure... ???
- names:
- P0: based on VM name specified by user (see also CLI, Portal).
- [X] P0: always fail if exist
- P1: can we reuse it? ???
- P1: fallback: throw (suggests...) or reuse?
- P1: default shared name for Network (something else?!). CLI?? Portal??
- P2 optional VM name.
- P1 Create Or Update scenario.
- P2 Rollback

## Tasks

- [X] P0: required modules
- [ ] replace Write-Host
- [X]: P0: remove Write-Host
- [ ]: P1: add progress
- [X] P0: parameter attributes
- [ ] P0: Linux image
- [ ] P0: more default parameters
- [X] P0: having a package.
- [ ] P1: Project build.

## Graph

1. `Location`
1. `ResourceGroup`
- depends on `Location`
- children
1. `VirtualNetwork`
- depends on `Location`
- children
1. `Subnet`
1. `PublicIpAddress`
- depends on `Location`
1. `SecurityGroup`
- depends on `Location`
- children
1. `SecurityRule`
1. `NetworkInterface`
- depends on `PublicIpAddress`, `Subnet`, `SecurityGroup`, `Location`
1. `Vm`
- depends on `NetworkInterface`, `Location`

## Levels

1. Resources:
- `Location` (shared),
- `ResourceGroup` (shared) <- `Location`
1. Resources:
- `SecurityGroup` -> `SecurityRule`
- `Subnet` <- `VirtualNetwork` (shared?)
- `PublicIpAddress`
1. Resources:
- `NetworkInterface` (unique) ?
1. Resources:
- `VM`

## Behavior

a parameter value:
- undefined
- user's value

if a resource exists
- then
- else

resource name:
1. undefined
1. resource exists - reuse|with validation (fail? or workaround or interactive)
1. resource doesn't exist - create
1. user's value
1. resource exist - reuse
1. resource doesn't exist - fail (create?)

smart location. Should it depends on a resource group location?

default parameters - work backward

## Resource Acquisition Matrix

1. A resource name is
- undefined
- user's specified name
- user's specified id
1. A resource
- exists
- doesn't exist
1. A resource is
- shared
- unique

## C# vs PowerShell

### Proposal 1

- use C# to implement logic and type descriptions (no PowerShell dependencies, only .Net Standard and Azure SDK dependencies).
- use PowerShell to make a facade.

### Proposal 2

- use C# to implement logic and type descriptions (with PowerShell dependencies)
- probably, no need for PSM1 files.

### C# advantages

- type/contract validations at compile time.
- much more feature to express logic, relations etc.
- testing is easier and, probably, faster.
- performance ?.
- customers may use the C# library for .Net programs (C#/VB/F#/...).
- C# type system is much more mature and well documented compare to PowerShell v5 classes.

## Tasks

- changelog
- remove warnings (-WarningAction=SilentContinue)
- help
- linux
- e2e manual test (Windows, Linux).
- feedback
- (-Auto)
- tab-completion
- VMSS
- rolling back
- output object

## 9/15

- [X] [P-1] help (in doc, example)
- - signing (9/14)
- output format (Get-AzureRmVm)
- talk to Aaron
- how to use (connect to VM etc).
- output
- information stream (Write-Information)
- proper cmdlet + parameter attributes + struct
- [X] positional parameters (PR) (position 0 for name)
- [X] [P-1] shouldprocess (example)

- [P0.5] validation (PSScript analyser)
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,35 @@ $vmComputerUser = $credentials.vmUser;
$password = ConvertTo-SecureString $vmComputerPassword -AsPlainText -Force;
$vmCredential = New-Object System.Management.Automation.PSCredential ($vmComputerUser, $password);

New-AzVm -Name MyVM -Credential $vmCredential -WhatIf

# $job = New-AzVm -Name MyVMA -Credential $vmCredential -AsJob
# Receive-Job $job

# exit

# $vm = New-AzVm
# $vm = New-AzVm -Credential $vmCredential
$vm = New-AzVm -Name MyVMA1 -Credential $vmCredential -ResourceGroupName Crocodile
# $vm = New-AzVm -Name MyVMA

$vm

# Write-Host "<async>"
# $job = New-AzVm -Name MyVMA3 -Credential $vmCredential -AsJob
# $vm = Receive-Job $job -Wait
# $vm
# Write-Host "</async>"

# clean-up
Remove-AzureRmResourceGroup -ResourceId $vm.ResourceGroupId
Describe 'New-AzVm' {
It 'WhatIf' {
$result = New-AzVm -Name MyVM -Credential $vmCredential -WhatIf
}
It 'Create Windows VM' {
Remove-AzureRmResourceGroup -Name Something1 -Force

$result = New-AzVm -Name MyVMA1 -Credential $vmCredential -ResourceGroupName Something1 -Verbose

$result.Name | Should Be MyVMA1
}
It 'Create Linux VM' {
$context = Get-AzureRmContext
$result = New-AzVm `
-Name X2 `
-Credential $vmCredential `
-Location westus2 `
-ResourceGroupName Something1 `
-AzureRmContext $context `
-ImageName UbuntuLTS `
-Verbose
$result.Name | Should Be X2
}
It 'Create Linux VM AsJob' {
Remove-AzureRmResourceGroup -Name MyVMA3 -Force

$job = New-AzVm -Name MyVMA3 -Credential $vmCredential -AsJob -ImageName UbuntuLTS -Verbose
$result = Receive-Job $job -Wait -Verbose

$result.Name | Should Be MyVMA3
}
}
Loading