Skip to content

Commit 829a6c5

Browse files
azure-powershell-botlijinpei2008VeryEarly
authored
Migrate WebSites from generation to main (#21340)
* Move WebSites to main * Create 'UX' folder and update changelog * Update ChangeLog.md * fix examples --------- Co-authored-by: Jinpei Li <[email protected]> Co-authored-by: Yabo Hu <[email protected]>
1 parent c01b69a commit 829a6c5

File tree

1,446 files changed

+16504
-9760
lines changed

Some content is hidden

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

1,446 files changed

+16504
-9760
lines changed

src/Websites/Websites.Autorest/Az.Websites.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DotNetFrameworkVersion = '4.7.2'
1212
RequiredAssemblies = './bin/Az.Websites.private.dll'
1313
FormatsToProcess = './Az.Websites.format.ps1xml'
14-
FunctionsToExport = 'Get-AzStaticWebApp', 'Get-AzStaticWebAppBuild', 'Get-AzStaticWebAppBuildAppSetting', 'Get-AzStaticWebAppBuildFunction', 'Get-AzStaticWebAppBuildFunctionAppSetting', 'Get-AzStaticWebAppConfiguredRole', 'Get-AzStaticWebAppCustomDomain', 'Get-AzStaticWebAppFunction', 'Get-AzStaticWebAppFunctionAppSetting', 'Get-AzStaticWebAppSecret', 'Get-AzStaticWebAppSetting', 'Get-AzStaticWebAppUser', 'Get-AzStaticWebAppUserProvidedFunctionApp', 'New-AzStaticWebApp', 'New-AzStaticWebAppBuildAppSetting', 'New-AzStaticWebAppBuildFunctionAppSetting', 'New-AzStaticWebAppCustomDomain', 'New-AzStaticWebAppFunctionAppSetting', 'New-AzStaticWebAppSetting', 'New-AzStaticWebAppUserRoleInvitationLink', 'Register-AzStaticWebAppUserProvidedFunctionApp', 'Remove-AzStaticWebApp', 'Remove-AzStaticWebAppAttachedRepository', 'Remove-AzStaticWebAppBuild', 'Remove-AzStaticWebAppCustomDomain', 'Remove-AzStaticWebAppUser', 'Reset-AzStaticWebAppApiKey', 'Test-AzStaticWebAppCustomDomain', 'Unregister-AzStaticWebAppBuildUserProvidedFunctionApp', 'Unregister-AzStaticWebAppUserProvidedFunctionApp', 'Update-AzStaticWebApp', 'Update-AzStaticWebAppUser', '*'
14+
FunctionsToExport = 'Get-AzStaticWebApp', 'Get-AzStaticWebAppBuild', 'Get-AzStaticWebAppBuildAppSetting', 'Get-AzStaticWebAppBuildFunction', 'Get-AzStaticWebAppBuildFunctionAppSetting', 'Get-AzStaticWebAppConfiguredRole', 'Get-AzStaticWebAppCustomDomain', 'Get-AzStaticWebAppFunction', 'Get-AzStaticWebAppFunctionAppSetting', 'Get-AzStaticWebAppSecret', 'Get-AzStaticWebAppSetting', 'Get-AzStaticWebAppUser', 'Get-AzStaticWebAppUserProvidedFunctionApp', 'Get-AzWebAppContinuousWebJob', 'Get-AzWebAppSlotContinuousWebJob', 'Get-AzWebAppSlotTriggeredWebJob', 'Get-AzWebAppSlotTriggeredWebJobHistory', 'Get-AzWebAppSlotWebJob', 'Get-AzWebAppTriggeredWebJob', 'Get-AzWebAppTriggeredWebJobHistory', 'Get-AzWebAppWebJob', 'New-AzStaticWebApp', 'New-AzStaticWebAppBuildAppSetting', 'New-AzStaticWebAppBuildFunctionAppSetting', 'New-AzStaticWebAppCustomDomain', 'New-AzStaticWebAppFunctionAppSetting', 'New-AzStaticWebAppSetting', 'New-AzStaticWebAppUserRoleInvitationLink', 'Register-AzStaticWebAppUserProvidedFunctionApp', 'Remove-AzStaticWebApp', 'Remove-AzStaticWebAppAttachedRepository', 'Remove-AzStaticWebAppBuild', 'Remove-AzStaticWebAppCustomDomain', 'Remove-AzStaticWebAppUser', 'Remove-AzWebAppContinuousWebJob', 'Remove-AzWebAppSlotContinuousWebJob', 'Remove-AzWebAppSlotTriggeredWebJob', 'Remove-AzWebAppTriggeredWebJob', 'Reset-AzStaticWebAppApiKey', 'Start-AzWebAppContinuousWebJob', 'Start-AzWebAppSlotContinuousWebJob', 'Start-AzWebAppSlotTriggeredWebJob', 'Start-AzWebAppTriggeredWebJob', 'Stop-AzWebAppContinuousWebJob', 'Stop-AzWebAppSlotContinuousWebJob', 'Test-AzStaticWebAppCustomDomain', 'Unregister-AzStaticWebAppBuildUserProvidedFunctionApp', 'Unregister-AzStaticWebAppUserProvidedFunctionApp', 'Update-AzStaticWebApp', 'Update-AzStaticWebAppUser', '*'
1515
AliasesToExport = '*'
1616
PrivateData = @{
1717
PSData = @{

src/Websites/Websites.Autorest/Az.Websites.psm1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
}
2626
}
2727
if(-not $accountsModule) {
28-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
28+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0
2929
if($hasAdequateVersion) {
30-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
30+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru
3131
}
3232
}
3333
}
3434

3535
if(-not $accountsModule) {
36-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37-
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
38-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
36+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37+
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
38+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3939
}
4040
Write-Information "Loaded Module '$($accountsModule.Name)'"
4141

@@ -50,6 +50,10 @@
5050

5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
53+
54+
# Following two delegates are added for telemetry
55+
$instance.GetTelemetryId = $VTable.GetTelemetryId
56+
$instance.Telemetry = $VTable.Telemetry
5357

5458

5559
# Tweaks the pipeline per call

src/Websites/Websites.Autorest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This directory contains the PowerShell module for the Websites service.
1717
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
1818

1919
## Module Requirements
20-
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
20+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
2121

2222
## Authentication
2323
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.

src/Websites/Websites.Autorest/build-module.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ $null = New-Item -ItemType Directory -Force -Path $examplesFolder
123123

124124
Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...'
125125
$modelCmdlets = @()
126+
$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets'
127+
if (Test-Path $modelCmdletFolder) {
128+
$null = Remove-Item -Force -Recurse -Path $modelCmdletFolder
129+
}
126130
if ($modelCmdlets.Count -gt 0) {
127131
. (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1')
128132
CreateModelCmdlet($modelCmdlets)

src/Websites/Websites.Autorest/check-dependencies.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(-not $Isolated) {
2525
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
2626
if($predicate) {
2727
$module = Get-Module -ListAvailable -Name $moduleName
28-
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
28+
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) {
2929
$null = New-Item -ItemType Directory -Force -Path $path
3030
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
3131
if ($requiredVersion) {
@@ -47,7 +47,7 @@ if(Test-Path -Path $localModulesPath) {
4747
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
4848
}
4949

50-
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.2.3'
50+
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5'
5151
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'
5252

5353
$tools = Join-Path $PSScriptRoot 'tools'

src/Websites/Websites.Autorest/create-model-cmdlets.ps1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ function CreateModelCmdlet {
2323
}
2424

2525
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
26-
$ModuleName = 'Websites'
2726
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
2827
$null = New-Item -ItemType Directory -Force -Path $OutputDir
28+
if (''.length -gt 0) {
29+
$ModuleName = ''
30+
} else {
31+
$ModuleName = 'Az.Websites'
32+
}
2933

3034
$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
3135
$Content = ''
@@ -64,10 +68,10 @@ function CreateModelCmdlet {
6468
$ObjectType = $Model
6569
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
6670
# remove duplicated module name
67-
if ($ObjectType.StartsWith($ModuleName)) {
71+
if ($ObjectType.StartsWith('Websites')) {
6872
$ModulePrefix = ''
6973
} else {
70-
$ModulePrefix = $ModuleName
74+
$ModulePrefix = 'Websites'
7175
}
7276
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir
7377

@@ -115,7 +119,9 @@ function CreateModelCmdlet {
115119
# check whether completer is needed
116120
$completer = '';
117121
if($Type.Split('.').Split('.')[-2] -eq 'Support') {
118-
$completer += "`n [ArgumentCompleter([${Type}])]"
122+
# If Type is an array, need to strip []
123+
$strippedType = $Type.Replace('[]', '')
124+
$completer += "`n [ArgumentCompleter([${strippedType}])]"
119125
}
120126
$ParameterDefineScript = "
121127
[Parameter($ParameterDefineProperty)]${completer}
@@ -156,7 +162,7 @@ Create an in-memory object for ${ObjectType}.
156162
.Outputs
157163
${ObjectTypeWithNamespace}
158164
.Link
159-
https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
165+
https://learn.microsoft.com/powershell/module/${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
160166
#>
161167
function New-Az${ModulePrefix}${ObjectType}Object {
162168
[OutputType('${ObjectTypeWithNamespace}')]

src/Websites/Websites.Autorest/custom/New-AzStaticWebApp.ps1

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -285,41 +285,15 @@ param(
285285
${ProxyUseDefaultCredentials}
286286
)
287287

288-
begin {
289-
try {
290-
$outBuffer = $null
291-
if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
292-
$PSBoundParameters['OutBuffer'] = 1
288+
process {
289+
try {
290+
if(!$PSBoundParameters.ContainsKey('RepositoryUrl')) {
291+
$PSBoundParameters.RepositoryUrl = ''
292+
}
293+
294+
Az.Websites.internal\New-AzStaticWebApp @PSBoundParameters
295+
} catch {
296+
throw
293297
}
294-
$parameterSet = $PSCmdlet.ParameterSetName
295-
$mapping = @{
296-
CreateExpanded = 'Az.Websites.private\New-AzStaticWebApp_CreateExpanded';
297-
}
298-
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
299-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
300-
}
301-
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
302-
$scriptCmd = {& $wrappedCmd @PSBoundParameters}
303-
$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
304-
$steppablePipeline.Begin($PSCmdlet)
305-
} catch {
306-
throw
307-
}
308-
}
309-
310-
process {
311-
try {
312-
$steppablePipeline.Process($_)
313-
} catch {
314-
throw
315298
}
316299
}
317-
318-
end {
319-
try {
320-
$steppablePipeline.End()
321-
} catch {
322-
throw
323-
}
324-
}
325-
}

src/Websites/Websites.Autorest/docs/Get-AzStaticWebApp.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ This commands gets a satic web application by name.
8282

8383
### Example 4: Get a satic web application by pipline
8484
```powershell
85-
New-AzStaticWebApp -ResourceGroupName azure-rg-test -Name staticweb-pwsh01 -Location eastus2 -RepositoryUrl 'https://github.com/username/RepoName' -RepositoryToken 'repoToken123' -Branch 'master' -AppLocation 'Client' -ApiLocation 'Api' -OutputLocation 'wwwroot' -SkuName 'free' -SkuTier 'free' | Get-AzStaticWebApp -InputObejct
85+
New-AzStaticWebApp -ResourceGroupName azure-rg-test -Name staticweb-pwsh01 -Location eastus2 -RepositoryUrl 'https://github.com/username/RepoName' -RepositoryToken 'repoToken123' -Branch 'master' -AppLocation 'Client' -ApiLocation 'Api' -OutputLocation 'wwwroot' -SkuName 'free' | Get-AzStaticWebApp
8686
```
8787

8888
```output
@@ -96,7 +96,8 @@ This commands gets a satic web application by pipline.
9696
## PARAMETERS
9797

9898
### -DefaultProfile
99-
The credentials, account, tenant, and subscription used for communication with Azure.
99+
The DefaultProfile parameter is not functional.
100+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
100101

101102
```yaml
102103
Type: System.Management.Automation.PSObject
@@ -193,7 +194,7 @@ COMPLEX PARAMETER PROPERTIES
193194
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
194195
195196
196-
INPUTOBJECT <IWebsitesIdentity>: Identity Parameter
197+
`INPUTOBJECT <IWebsitesIdentity>`: Identity Parameter
197198
- `[Authprovider <String>]`: The auth provider for the users.
198199
- `[DomainName <String>]`: The custom domain name.
199200
- `[EnvironmentName <String>]`: The stage site identifier.

src/Websites/Websites.Autorest/docs/Get-AzStaticWebAppBuild.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ This command gets the details of a static site build by pipeline.
7777
## PARAMETERS
7878

7979
### -DefaultProfile
80-
The credentials, account, tenant, and subscription used for communication with Azure.
80+
The DefaultProfile parameter is not functional.
81+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
8182

8283
```yaml
8384
Type: System.Management.Automation.PSObject
@@ -189,7 +190,7 @@ COMPLEX PARAMETER PROPERTIES
189190
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
190191
191192
192-
INPUTOBJECT <IWebsitesIdentity>: Identity Parameter
193+
`INPUTOBJECT <IWebsitesIdentity>`: Identity Parameter
193194
- `[Authprovider <String>]`: The auth provider for the users.
194195
- `[DomainName <String>]`: The custom domain name.
195196
- `[EnvironmentName <String>]`: The stage site identifier.

src/Websites/Websites.Autorest/docs/Get-AzStaticWebAppBuildAppSetting.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ This command gets the application settings of a static web build.
3838
## PARAMETERS
3939

4040
### -DefaultProfile
41-
The credentials, account, tenant, and subscription used for communication with Azure.
41+
The DefaultProfile parameter is not functional.
42+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
4243

4344
```yaml
4445
Type: System.Management.Automation.PSObject

0 commit comments

Comments
 (0)