You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment type (Please select at least one enviroment where you face this issue)
Self-Hosted
Microsoft Hosted
VMSS Pool
Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows
Question
I am trying to schedule start/stop container apps but the following pipeline is not stopping / starting container app.
trigger: none
schedules:
- cron: "0 22 * * *"
displayName: 'Shutdown Schedule'
branches:
include:
- main
always: true
- cron: "0 7 * * *"
displayName: 'Startup Schedule'
branches:
include:
- main
always: true
jobs:
- job: Shutdown
condition: and(succeeded(), eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.CronSchedule.DisplayName'], 'Shutdown Schedule'))
pool:
vmImage: 'windows-latest'
steps:
- task: AzurePowerShell@5
inputs:
azureSubscription: 'your service connection name'
ScriptType: 'InlineScript'
Inline: 'Stop-AzContainerApp -Name yourContainerAppname -ResourceGroupName yourResourceGroupname -SubscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
azurePowerShellVersion: 'LatestVersion'
- job: Startup
condition: and(succeeded(), eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.CronSchedule.DisplayName'], 'Startup Schedule'))
pool:
vmImage: 'windows-latest'
steps:
- task: AzurePowerShell@5
inputs:
azureSubscription: 'your service connection name'
ScriptType: 'InlineScript'
Inline: 'Start-AzContainerApp -Name yourContainerAppname -ResourceGroupName yourResourceGroupname -SubscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
azurePowerShellVersion: 'LatestVersion'
getting following output from logs
2025-01-09T11:34:38.6819845Z ##[section]Starting: AzurePowerShell
2025-01-09T11:34:38.6828908Z ==============================================================================
2025-01-09T11:34:38.6829064Z Task : Azure PowerShell
2025-01-09T11:34:38.6829135Z Description : Run a PowerShell script within an Azure environment
2025-01-09T11:34:38.6829245Z Version : 5.248.3
2025-01-09T11:34:38.6829321Z Author : Microsoft Corporation
2025-01-09T11:34:38.6829395Z Help : https://aka.ms/azurepowershelltroubleshooting
2025-01-09T11:34:38.6829481Z ==============================================================================
2025-01-09T11:34:40.0422222Z Generating script.
2025-01-09T11:34:40.1104524Z ========================== Starting Command Output ===========================
2025-01-09T11:34:40.1425584Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\9807e309-1b05-46d8-8f15-0ce4894f5af2.ps1'"
2025-01-09T11:34:41.7241283Z Added TLS 1.2 in session.
2025-01-09T11:34:42.1412994Z ##[command]Import-Module -Name C:\Modules\az_12.1.0\Az.Accounts\4.0.0\Az.Accounts.psd1 -Global
2025-01-09T11:34:51.6736952Z ##[command]Enable-AzureRmAlias -Scope Process
2025-01-09T11:34:55.1114651Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2025-01-09T11:34:55.3837992Z ##[command]Clear-AzContext -Scope Process
2025-01-09T11:34:55.4391888Z ##[command]Connect-AzAccount
2025-01-09T11:34:57.7437226Z VERBOSE: Command [Connect-AzAccount] succeeded.
2025-01-09T11:34:57.7498693Z ##[command]Set-AzContext
2025-01-09T11:35:38.1402516Z TemplateInitContainer :
2025-01-09T11:35:38.1402985Z TemplateRevisionSuffix :
2025-01-09T11:35:38.1403341Z TemplateServiceBind :
2025-01-09T11:35:38.1403561Z TemplateTerminationGracePeriodSecond :
2025-01-09T11:35:38.1404572Z TemplateVolume :
2025-01-09T11:35:38.1404961Z Type : Microsoft.App/containerApps
2025-01-09T11:35:38.1405223Z WorkloadProfileName : consumption
2025-01-09T11:35:38.1405620Z
2025-01-09T11:35:38.1737740Z
2025-01-09T11:35:38.1740389Z
2025-01-09T11:35:38.4158605Z Added TLS 1.2 in session.
2025-01-09T11:35:39.7654845Z WARNING: Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the
2025-01-09T11:35:39.7655655Z same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can
2025-01-09T11:35:39.7656183Z use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure
2025-01-09T11:35:39.7656612Z Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found
2025-01-09T11:35:39.7657508Z here: https://aka.ms/azps-migration-guide
2025-01-09T11:35:40.9540248Z ##[command]Disconnect-AzAccount -Scope CurrentUser -ErrorAction Stop
2025-01-09T11:35:41.2321940Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
2025-01-09T11:35:41.2657386Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
2025-01-09T11:35:41.5274474Z ##[section]Finishing: AzurePowerShell
tried as well with
env:
RETIRE_AZURERM_POWERSHELL_MODULE: true
but i am still getting the same response
The text was updated successfully, but these errors were encountered:
Task name
AzurePowerShell@5
Task version
No response
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows
Question
The text was updated successfully, but these errors were encountered: