-1

I would like to create ACI using the following command in PowerShell:

New-AzContainerGroup -ResourceGroupName acr -Name benighilmohamed ` -Image alpine -OsType Linux ` -Command "echo 'Hello from an Azure container instance triggered by an Azure function'" ` -RestartPolicy Never 

But I get the following error :

Cannot process argument transformation on parameter 'ImageRegistryCredential'. Cannot convert value "alpine" to type "Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.Api20240501Preview.IImageRegistryCredential[]".
Error: "Cannot convert the "alpine" value of type "System.String" to type "Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.Api20240501Preview.IImageRegistryCredential"

I don't see exactly what is going on.

2
  • New-AzContainerGroup doesn't have an -Image parameter, perhaps you're confusing the command with New-AzContainerInstanceObject? Commented May 11 at 13:45
  • @Mohamed, did the answer below resolve your issue? Commented May 12 at 8:31

1 Answer 1

0

Mathias is right. There is no -Image parameter in New-AzContainerGroup. You should create a container instance object first and then use it to create the container group.

$container = New-AzContainerInstanceObject -Name benighilmohamed -Image alpine -OsType Linux -Command "echo 'Hello from an Azure container instance triggered by an Azure function'

New-AzContainerGroup -ResourceGroupName acr -Name benighilmohamed -Container $container -OsType Linux -RestartPolicy Never

This should fix your issue and will create the ACI

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.