Hello @MS Techie
Most of scripts on the internet is possible that are not updated for azure changes in formats or syntaxes. There is a fresh publication from Microsoft on the matter that should work successfully:
you can find all details here: https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/programmatically-create-subscription-enterprise-agreement?tabs=rest
Hope this resolves your query,
Best regards,