I´m really new to the Azure platform and maybe this is a dumb question but i haven´t manage to find information about this topic. I really need help with this. I'm deploying a database used by a web service for a university project. In this database I have an stored procedure and need to run it daily.
Found that with Azure Automation you could program or schedule this kind of actions. I "installed" the service and I´m trying to create the "runbook" but don´t know how or what to code in here because I never used PowerShell that much.
Any help provided will be appreciated. Thanks in advance!
EDIT 1:
So I'm trying to use this code to make the magic:
workflow WORKFLOW_NAME
{
param(
)
inlinescript {
# Define the connection to the SQL Database
$Conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=SERVER_NAME.database.windows.net;Initial Catalog=DATABASE_NAME;Integrated Security=False;User ID=USERNAME;Password=PASSWORD;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False")
# Open the SQL connection
$Conn.Open()
# Define the SQL command to run.
$Cmd=new-object system.Data.SqlClient.SqlCommand("exec PROCEDURE_NAME", $Conn)
$Cmd.CommandTimeout=120
# Execute the SQL command
$Da=New-Object system.Data.SqlClient.SqlDataAdapter($Cmd)
# Close the SQL connection
$Conn.Close()
}
}
The thing is that when I save the RunBook and publish it, it says there is no errors. When I run the RunBook it starts and finish sending no errors nor exceptions, so you could expect it did the work right?, but when consulting the database there is no modifications in the tables the procedure is intended to modify. What could be the error in this? what am I doing wrong?
I took the reference code from https://gallery.technet.microsoft.com/scriptcenter/How-to-use-a-SQL-Command-be77f9d2#content , personalized it and got rid of the "param" because the RunBook when started, never asked for any entry parameters, so I decided to go with the full connection string. I'm using the same connection string as my c# project, which connects and works perfectly.
I'm using the "new" azure interface, don't know if this could be of any importance in this regard.
Again, thank you for any help you could provide.