Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 14 additions & 10 deletions src/App/App.Autorest/Az.App.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,41 @@

# Ask for the shared functionality table
$VTable = Register-AzModule

# Tweaks the pipeline on module load
$instance.OnModuleLoad = $VTable.OnModuleLoad

# Following two delegates are added for telemetry
$instance.GetTelemetryId = $VTable.GetTelemetryId
$instance.Telemetry = $VTable.Telemetry


# Delegate to sanitize the output object
$instance.SanitizeOutput = $VTable.SanitizerHandler

# Delegate to get the telemetry info
$instance.GetTelemetryInfo = $VTable.GetTelemetryInfo

# Tweaks the pipeline per call
$instance.OnNewRequest = $VTable.OnNewRequest

# Gets shared parameter values
$instance.GetParameterValue = $VTable.GetParameterValue

# Allows shared module to listen to events from this module
$instance.EventListener = $VTable.EventListener

# Gets shared argument completers
$instance.ArgumentCompleter = $VTable.ArgumentCompleter

# The name of the currently selected Azure profile
$instance.ProfileName = $VTable.ProfileName


# Load the custom module
$customModulePath = Join-Path $PSScriptRoot './custom/Az.App.custom.psm1'
if(Test-Path $customModulePath) {
$null = Import-Module -Name $customModulePath
}

# Export nothing to clear implicit exports
Export-ModuleMember

Expand All @@ -97,12 +101,12 @@
# Load the last folder if no profile is selected
$profileDirectory = $directories | Select-Object -Last 1
}

if($profileDirectory) {
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
$exportsPath = $profileDirectory.FullName
}

if($exportsPath) {
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath
Expand Down
23 changes: 22 additions & 1 deletion src/App/App.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
This directory contains the PowerShell module for the App service.

---

## Info
- Modifiable: yes
- Generated: all
Expand Down Expand Up @@ -63,6 +62,8 @@ identity-correction-for-post: true
resourcegroup-append: true
nested-object-to-string: true
auto-switch-view: false
disable-transform-identity-type: true
flatten-userassignedidentity: false

use-extension:
"@autorest/powershell": "4.x"
Expand Down Expand Up @@ -671,4 +672,24 @@ directive:
verb: Remove
subject: ContainerAppSourceControl
remove: true

##### announce upcoming MI-related breaking changes
- where:
parameter-name: IdentityType
set:
breaking-change:
change-description: IdentityType will be removed. EnableSystemAssignedIdentity will be used to enable/disable system assigned identity and UserAssignedIdentity will be used to specify user assigned identities.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 13.0.0
change-effective-date: 2024/11/19
- where:
parameter-name: IdentityUserAssignedIdentity
set:
breaking-change:
old-parameter-type: Hashtable
new-parameter-type: string[]
change-description: IdentityUserAssignedIdentity will be renamed to UserAssignedIdentity. And its type will be simplified as string array.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 13.0.0
change-effective-date: 2024/11/19
```
18 changes: 17 additions & 1 deletion src/App/App.Autorest/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# ----------------------------------------------------------------------------------
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX)
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX, [Switch]$DisableAfterBuildTasks)
$ErrorActionPreference = 'Stop'

if($PSEdition -ne 'Core') {
Expand Down Expand Up @@ -177,4 +177,20 @@ if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
}

$assemblyInfoPath = Join-Path $PSScriptRoot 'Properties' 'AssemblyInfo.cs'
if (-not (Test-Path $assemblyInfoPath) -And [System.Convert]::ToBoolean('true')) {
Write-Host -ForegroundColor Green 'Creating assembly info...'
New-AssemblyInfo
}

if (-not $DisableAfterBuildTasks){
$afterBuildTasksPath = Join-Path $PSScriptRoot ''
$afterBuildTasksArgs = ConvertFrom-Json 'true' -AsHashtable
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
Write-Host -ForegroundColor Green 'Executing after build tasks...'
. $afterBuildTasksPath @afterBuildTasksArgs
}
}


Write-Host -ForegroundColor Green '-------------Done-------------'
4 changes: 2 additions & 2 deletions src/App/App.Autorest/examples/New-AzContainerApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName azps_test_group_app -N

New-SelfSignedCertificate -DnsName "www.fabrikam.com", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My"
Get-ChildItem -Path cert:\LocalMachine\My
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$mypwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
Get-ChildItem -Path cert:\localMachine\my\F61C9A8C53D0500F819463A66C5921AA09E1B787 | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd
New-AzContainerAppManagedEnvCert -EnvName azps-env -Name azps-env-cert -ResourceGroupName azps_test_group_app -Location eastus -InputFile "C:\mypfx.pfx" -Password $mypwd

Expand Down Expand Up @@ -47,7 +47,7 @@ $EnvId = (Get-AzContainerAppConnectedEnv -ResourceGroupName azps_test_group_app

New-SelfSignedCertificate -DnsName "www.fabrikam.com", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My"
Get-ChildItem -Path cert:\LocalMachine\My
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$mypwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
Get-ChildItem -Path cert:\localMachine\my\F61C9A8C53D0500F819463A66C5921AA09E1B787 | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd
New-AzContainerAppConnectedEnvCert -Name azps-connectedenvcert -ConnectedEnvironmentName azps-connectedenv -ResourceGroupName azps_test_group_app -Location eastus -InputFile "C:\mypfx.pfx" -Password $mypwd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
```powershell
New-SelfSignedCertificate -DnsName "www.fabrikam.com", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My"
Get-ChildItem -Path cert:\LocalMachine\My
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$mypwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
Get-ChildItem -Path cert:\localMachine\my\F61C9A8C53D0500F819463A66C5921AA09E1B787 | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd

New-AzContainerAppConnectedEnvCert -Name azps-connectedenvcert -ConnectedEnvironmentName azps-connectedenv -ResourceGroupName azps_test_group_app -Location eastus -InputFile "C:\mypfx.pfx" -Password $mypwd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
```powershell
New-SelfSignedCertificate -DnsName "www.fabrikam.com", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My"
Get-ChildItem -Path cert:\LocalMachine\My
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$mypwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
Get-ChildItem -Path cert:\localMachine\my\F61C9A8C53D0500F819463A66C5921AA09E1B787 | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd

New-AzContainerAppManagedEnvCert -EnvName azps-env -Name azps-env-cert -ResourceGroupName azps_test_group_app -Location eastus -InputFile "C:\mypfx.pfx" -Password $mypwd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Example 1: Create the SourceControl for a Container App.
```powershell
$AzureClientSecret = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$RegistryPassword = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$GithubAccessToken = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$AzureClientSecret = ConvertTo-SecureString -String "****" -AsPlainText -Force
$RegistryPassword = ConvertTo-SecureString -String "****" -AsPlainText -Force
$GithubAccessToken = ConvertTo-SecureString -String "****" -AsPlainText -Force

New-AzContainerAppSourceControl -ContainerAppName azps-containerapp-1 -ResourceGroupName azps_test_group_app -Name current -AzureClientId "UserObjectId" -AzureClientSecret $AzureClientSecret -AzureKind "feaderated" -AzureTenantId "UserDirectoryID" -Branch "main" -GithubContextPath "./" -GithubAccessToken $GithubAccessToken -GithubConfigurationImage "azps-containerapp-1" -RegistryPassword $RegistryPassword -RegistryUrl "azpscontainerregistry.azurecr.io" -RegistryUserName "azpscontainerregistry" -RepoUrl "https://github.com/lijinpei2008/ghatest"
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Example 1: Update source control for a Container App.
```powershell
$AzureClientSecret = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$RegistryPassword = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$GithubAccessToken = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$AzureClientSecret = ConvertTo-SecureString -String "****" -AsPlainText -Force
$RegistryPassword = ConvertTo-SecureString -String "****" -AsPlainText -Force
$GithubAccessToken = ConvertTo-SecureString -String "****" -AsPlainText -Force

Update-AzContainerAppSourceControl -ContainerAppName azps-containerapp-1 -ResourceGroupName azps_test_group_app -Name current -AzureClientId "UserObjectId" -AzureClientSecret $AzureClientSecret -AzureKind "feaderated" -AzureTenantId "UserDirectoryID" -Branch "main" -GithubContextPath "./" -GithubAccessToken $GithubAccessToken -GithubConfigurationImage "azps-containerapp-1" -RegistryPassword $RegistryPassword -RegistryUrl "azpscontainerregistry.azurecr.io" -RegistryUserName "azpscontainerregistry" -RepoUrl "https://github.com/lijinpei2008/ghatest"
```
Expand All @@ -17,9 +17,9 @@ Update source control for a Container App.

### Example 2: Update source control for a Container App.
```powershell
$AzureClientSecret = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$RegistryPassword = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$GithubAccessToken = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$AzureClientSecret = ConvertTo-SecureString -String "****" -AsPlainText -Force
$RegistryPassword = ConvertTo-SecureString -String "****" -AsPlainText -Force
$GithubAccessToken = ConvertTo-SecureString -String "****" -AsPlainText -Force
$sourcecontrol = Get-AzContainerAppSourceControl -ContainerAppName azps-containerapp-1 -ResourceGroupName azps_test_group_app -Name current

Update-AzContainerAppSourceControl -InputObject $sourcecontrol -AzureClientId "UserObjectId" -AzureClientSecret $AzureClientSecret -AzureKind "feaderated" -AzureTenantId "UserDirectoryID" -Branch "main" -GithubContextPath "./" -GithubAccessToken $GithubAccessToken -GithubConfigurationImage "azps-containerapp-1" -RegistryPassword $RegistryPassword -RegistryUrl "azpscontainerregistry.azurecr.io" -RegistryUserName "azpscontainerregistry" -RepoUrl "https://github.com/lijinpei2008/ghatest"
Expand All @@ -35,9 +35,9 @@ Update source control for a Container App.

### Example 3: Update source control for a Container App.
```powershell
$AzureClientSecret = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$RegistryPassword = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$GithubAccessToken = ConvertTo-SecureString -String "1234" -Force -AsPlainText
$AzureClientSecret = ConvertTo-SecureString -String "****" -AsPlainText -Force
$RegistryPassword = ConvertTo-SecureString -String "****" -AsPlainText -Force
$GithubAccessToken = ConvertTo-SecureString -String "****" -AsPlainText -Force
$containerapp = Get-AzContainerApp -ResourceGroupName azps_test_group_app -Name azps-containerapp-1

Update-AzContainerAppSourceControl -ContainerAppInputObject $containerapp -Name current -AzureClientId "UserObjectId" -AzureClientSecret $AzureClientSecret -AzureKind "feaderated" -AzureTenantId "UserDirectoryID" -Branch "main" -GithubContextPath "./" -GithubAccessToken $GithubAccessToken -GithubConfigurationImage "azps-containerapp-1" -RegistryPassword $RegistryPassword -RegistryUrl "azpscontainerregistry.azurecr.io" -RegistryUserName "azpscontainerregistry" -RepoUrl "https://github.com/lijinpei2008/ghatest"
Expand Down
10 changes: 7 additions & 3 deletions src/App/App.Autorest/exports/Disable-AzContainerAppRevision.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,12 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

[Parameter(ParameterSetName='DeactivateViaIdentityContainerApp', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for CONTAINERAPPINPUTOBJECT properties and create a hash table.
${ContainerAppInputObject},

[Parameter()]
Expand Down Expand Up @@ -208,7 +206,13 @@ begin {
DeactivateViaIdentityContainerApp = 'Az.App.private\Disable-AzContainerAppRevision_DeactivateViaIdentityContainerApp';
}
if (('Deactivate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
$testPlayback = $false
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
if ($testPlayback) {
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
} else {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
}
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
Expand Down
10 changes: 7 additions & 3 deletions src/App/App.Autorest/exports/Enable-AzContainerAppRevision.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,12 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

[Parameter(ParameterSetName='ActivateViaIdentityContainerApp', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for CONTAINERAPPINPUTOBJECT properties and create a hash table.
${ContainerAppInputObject},

[Parameter()]
Expand Down Expand Up @@ -208,7 +206,13 @@ begin {
ActivateViaIdentityContainerApp = 'Az.App.private\Enable-AzContainerAppRevision_ActivateViaIdentityContainerApp';
}
if (('Activate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
$testPlayback = $false
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
if ($testPlayback) {
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
} else {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
}
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
Expand Down
16 changes: 7 additions & 9 deletions src/App/App.Autorest/exports/Get-AzContainerApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

[Parameter()]
Expand Down Expand Up @@ -121,13 +120,6 @@ param(
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter(ParameterSetName='Get')]
[Parameter(ParameterSetName='GetViaIdentity')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Returns true when the command succeeds
${PassThru},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Runtime')]
[System.Uri]
Expand Down Expand Up @@ -180,7 +172,13 @@ begin {
List1 = 'Az.App.private\Get-AzContainerApp_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
$testPlayback = $false
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
if ($testPlayback) {
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
} else {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
}
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
Expand Down
10 changes: 7 additions & 3 deletions src/App/App.Autorest/exports/Get-AzContainerAppAuthConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,12 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

[Parameter(ParameterSetName='GetViaIdentityContainerApp', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.App.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.App.Models.IAppIdentity]
# Identity Parameter
# To construct, see NOTES section for CONTAINERAPPINPUTOBJECT properties and create a hash table.
${ContainerAppInputObject},

[Parameter()]
Expand Down Expand Up @@ -208,7 +206,13 @@ begin {
List = 'Az.App.private\Get-AzContainerAppAuthConfig_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
$testPlayback = $false
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
if ($testPlayback) {
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
} else {
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
}
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
Expand Down
Loading