Azure / Azure/azure-powershell

Invoke-AzContainerInstanceCommand - Script not stopping after successful command

Open
#16,854 13 comments 1 reaction 1 assignee Claimed by @BethanyZhou View on GitHub
act-observability-squad Container Instances customer-reported feature-request
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

Hi,

I am running `RunBook Version 7.1` and the latest ContainerInstance modules. The script runs fine and I can see the commands being executed on the container instance. However the script never stops. My script is as followed:

```
# Ensures you do not inherit an AzContext in your runbook
Disable-AzContextAutosave -Scope Process

# Connect to Azure with system-assigned managed identity
$AzureContext = (Connect-AzAccount -Identity).context

# set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext

Invoke-AzContainerInstanceCommand -ContainerGroupName byob-feature-product-engine -ContainerName byob-feature-product-engine-one -ResourceGroupName DevApplication -Command "npm run script_eod_daily_equity_prices"
```

Is seems as though the `Invoke-AzContainerInstanceCommand` isn't returning a success code or something for the script to know it has finished.

### Issue script & Debug output

```PowerShell
Mode : Process
ContextDirectory :
ContextFile :
CacheDirectory :
CacheFile :
Settings : {}

> byobeta@1.0.0 script_eod_daily_equity_prices
> python -c 'from etl.tasks import *; process_eod_daily_equity_prices()'

Getting Price for:BGFD.LSE
ETLException, BGFD.LSE , Cannot find EOD Price for:BGFD.LSE
Getting Price for:BDEV.LSE
ETLException, BDEV.LSE , Cannot find EOD Price for:BDEV.LSE
Getting Price for:BWY.LSE
ETLException, BWY.LSE , Cannot find EOD Price for:BWY.LSE
Getting Price for:VTY.LSE
ETLException, VTY.LSE , Cannot find EOD Price for:VTY.LSE
Getting Price for:GNS.LSE
ETLException, GNS.LSE , Cannot find EOD Price for:GNS.LSE
Getting Price for:AV.LSE
ETLException, AV.LSE , Cannot find EOD Price for:AV.LSE
Getting Price for:DGE.LSE
ETLException, DGE.LSE , Cannot find EOD Price for:DGE.LSE
Getting Price for:BDEV.LSE
ETLException, BDEV.LSE , Cannot find EOD Price for:BDEV.LSE
Getting Price for:HLMA.LSE
ETLException, HLMA.LSE , Cannot find EOD Price for:HLMA.LSE
Getting Price for:HNE.LSE
ETLException, HNE.LSE , Cannot find EOD Price for:HNE.LSE
Getting Price for:LGEN.LSE
ETLException, LGEN.LSE , Cannot find EOD Price for:LGEN.LSE
Getting Price for:BRWM.LSE
ETLException, BRWM.LSE , Cannot find EOD Price for:BRWM.LSE
Getting Price for:SCP.LSE
ETLException, SCP.LSE , Cannot find EOD Price for:SCP.LSE
Getting Price for:OXT.LSE
ETLException, OXT.LSE , Cannot find EOD Price for:OXT.LSE
Getting Price for:OXIG.LSE
ETLException, OXIG.LSE , Cannot find EOD Price for:OXIG.LSE
Getting Price for:PSN.LSE
ETLException, PSN.LSE , Cannot find EOD Price for:PSN.LSE
Getting Price for:UTG.LSE
ETLException, UTG.LSE , Cannot find EOD Price for:UTG.LSE
Getting Price for:PRU.LSE
ETLException, PRU.LSE , Cannot find EOD Price for:PRU.LSE
Getting Price for:LIO.LSE
ETLException, LIO.LSE , Cannot find EOD Price for:LIO.LSE
Getting Price for:SSE.LSE
ETLException, SSE.LSE , Cannot find EOD Price for:SSE.LSE
Getting Price for:SRP.LSE
ETLException, SRP.LSE , Cannot find EOD Price for:SRP.LSE
Getting Price for:MGNS.LSE
ETLException, MGNS.LSE , Cannot find EOD Price for:MGNS.LSE
Getting Price for:LLOY.LSE
ETLException, LLOY.LSE , Cannot find EOD Price for:LLOY.LSE
Equity - Daily Prices Saved: 0/23 :-1:
Equity - Daily Prices Not Found: 23 :-1:
Equity - Missing Daily Prices: BGFD.LSE BDEV.LSE BWY.LSE VTY.LSE GNS.LSE AV.LSE DGE.LSE BDEV.LSE HLMA.LSE HNE.LSE LGEN.LSE BRWM.LSE SCP.LSE OXT.LSE OXIG.LSE PSN.LSE UTG.LSE PRU.LSE LIO.LSE SSE.LSE SRP.LSE MGNS.LSE LLOY.LSE
:white_check_mark: Background task: Process EOD Daily Equity Prices For Products V2
```

### Environment data

```PowerShell
N/A
```

### Module versions

```PowerShell
Az.ContainerInstance
3.0.0
7.1 (preview)
```

### Error output

```PowerShell
N/A
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.