Azure / AKS

Azure Kubernetes Service
https://azure.github.io/AKS/
1.96k stars 305 forks source link

Error: "powershell is not recognized as internal or external command" in windows2022 node pool OS (AKS) #4250

Closed mefarazahmad closed 2 weeks ago

mefarazahmad commented 5 months ago

Describe the bug When using node pool OS as Windows2022 and docker image mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022, getting "powershell is not recognized as internal or external command" but when changes to windows2019 as node pool OS and image as "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019" it works

To Reproduce Steps to reproduce the behavior:

  1. I am first building the image using command az acr build --image devops/windows:v0.0.1 --registry registryName --platform windows . Use below docker file
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022

RUN powershell  -Command Set-ExecutionPolicy Bypass -Scope Process -Force; `
    [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
    iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

RUN powershell  -Command "Install-PackageProvider -Name NuGet -Force -Scope AllUsers"

RUN powershell  -Command "Install-Module -Name SqlServer -Force -Scope AllUsers"

RUN Setx /M PATH "\"C:\Program Files\Microsoft SQL Server\160\DAC\bin";$env:PATH\""

WORKDIR /azp/

COPY ./start.ps1 ./

CMD powershell .\start.ps1

and then using terraform module to create windows pods using the image build from above step

Expected behavior Kubernetes pods must run without any errors.

Screenshots

image image

Environment (please complete the following information):

microsoft-github-policy-service[bot] commented 4 months ago

Action required from @aritraghosh, @julia-yin, @AllenWen-at-Azure

microsoft-github-policy-service[bot] commented 3 months ago

Issue needing attention of @Azure/aks-leads

microsoft-github-policy-service[bot] commented 3 months ago

Issue needing attention of @Azure/aks-leads

microsoft-github-policy-service[bot] commented 2 months ago

Issue needing attention of @Azure/aks-leads

microsoft-github-policy-service[bot] commented 2 months ago

Issue needing attention of @Azure/aks-leads

microsoft-github-policy-service[bot] commented 1 month ago

Issue needing attention of @Azure/aks-leads

AbelHu commented 1 month ago

@mefarazahmad Please check the $env:path and powershell version and share the results of both ws2019 and ws2022 environments.

echo $PSVersionTable.PSVersion
echo $env:PATH
microsoft-github-policy-service[bot] commented 2 weeks ago

This issue will now be closed because it hasn't had any activity for 7 days after stale. mefarazahmad feel free to comment again on the next 7 days to reopen or open a new issue after that time if you still have a question/issue or suggestion.