If you are trying to execute a script on your databases using elastic jobs, you should first Create and configure the agent, the elastic database job agent (it is a service running on azure for automation on Azure SQL Databases).
in this case you should look into the links about it:
some overview about the service:
https://learn.microsoft.com/en-us/azure/sql-database/elastic-jobs-overview
configure the servic jobs using Powershell:
https://learn.microsoft.com/en-us/azure/sql-database/elastic-jobs-powershell
configure the servic jobs using TSQL:
https://learn.microsoft.com/en-us/azure/sql-database/elastic-jobs-tsql
If you just want to to use Power Shell to run the same script on all of your databases (once),
you may want to use another script dew to -ResourceGroupName
is a property of Elastic jobs.
you should try using command like Invoke-Sqlcmd
, iterating on all databases in the elastic pool.
https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-sqlcmd?view=sqlserver-ps
I recommend you to try look into the Powershell Model dbatools
(https://dbatools.io/)
it has a lot of useful powershell commands ready to use.