For me, my automation account didn't have access to the subscription I was trying to use in the runbook script. I went into the "Access control (IAM)" tab on the subscription of the resource I was trying to automate then made sure my automation account was set as a contributor (though a lesser role probably does it, I'm not sure which).