when we use the sh files in the hooks in the azure.yaml, they are not sent as executables and hence losing the permissions to execute via azd.
when we did the chmod +x hooks/*.sh it started working again, initially giving the permissions 126 error.
copilot summary on this:
azd ai agent init writes all downloaded files as 0644, breaking .sh hooks on Linux/macOS
When azd ai agent init downloads sample files from GitHub ( downloadDirectoryContents / downloadDirectoryContentsWithoutGhCli in init.go:3492,3604 ), it hardcodes os.WriteFile(..., 0644) . Shell scripts that are 100755 in git lose their executable bit, causing postprovision hooks to fail with "Permission denied" (exit 126).
Suggested fix: Either check strings.HasSuffix(path, ".sh") → os.Chmod(path, 0755) , or read the mode field from the GitHub Contents API response and apply it.
Screenshot of working vs non-working

when we use the sh files in the hooks in the azure.yaml, they are not sent as executables and hence losing the permissions to execute via azd.
when we did the chmod +x hooks/*.sh it started working again, initially giving the permissions 126 error.
Screenshot of working vs non-working