I got a similar issue..... changed a job to a deployment.... agent pool param decided it didn't want to work anymore. Not a permissions issue
top 3 work no drama, even the "if(pool == name) name" works, but the straight param as the pool name throws a fit. Will update this when I figure out how to fix it.
My Scenario: 4 different job/deployment blocks