You can use ARM/Bicep templates, AzureCLI, Azure Powershell and various SDKs to manage the SQL resources. You can even use Terraform:
resource "azurerm_cosmosdb_sql_stored_procedure" "example" {
name = "test-stored-proc"
resource_group_name = azurerm_cosmosdb_account.example.resource_group_name
account_name = azurerm_cosmosdb_account.example.name
database_name = azurerm_cosmosdb_sql_database.example.name
container_name = azurerm_cosmosdb_sql_container.example.name
body = <<BODY
function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }
BODY
}
I would try to use the same tooling as you are already using to maintain the database containers. If that does not make sense in your project, I would probably prefer AzureCLI instead of ARM templates in this specific case, because of how cumbersome it can be to maintain the function code inside the ARM template file.
With this command you can upload the contents of a sproc.js file as the function body:
az cosmosdb sql stored-procedure create \
--account-name myaccount \
--body @sproc.js \
--container-name mycontainer \
--database-name mydb \
--name myfunc \
--resource-group myrg