All guidance I've been able to find, points to using:
Microsoft.Azure.Management.ResourceManager.Fluent
but that package has been deprecated and suggests this (from the nuget page):
If you are looking for the latest packages to interact with Azure resources, please use the following libraries: Azure.ResourceManager Azure.ResourceManager.Resources
After installing those packages plus Azure.ResourceManager.AppService, I can get close with this:
var webApp = client.GetResourceGroupResource(ResourceIdentifier.Parse("resId"));
var webSite = webApp.GetWebSite("siteName").Value;
var webjob = webSite.GetWebSiteWebJob("jobname");
(resId, siteName and jobname aren't relevant for the question)
On the webSite object there is this:
webSite.Restart(); // also an Async version
But on the webjob, there is nothing I can see to kick off a restart. All of the following lack a restart option:
webjob.NotHere();
webjob.Value.NotHere();
webjob.value.Data.NotHere();
I feel like I'm missing something. How do I restart a webjob using the new nuget packages? Any guidance is greatly appreciated!
Figured out I was missing something simple. Webjobs can be triggered or continuous, only continuous may be stopped and started. So if the objective is to restart, I need to explicitly get only continuous webjobs, not simply 'webjobs'.
The above code becomes:
The key difference being, "GetWebSiteContinuousWebJob", which returns a "WebSiteContinuousWebJobResource", which has the required Start and Stop methods.