0

Like the title says, I need to get the latest deployment date of a function app. I'm trying different Azure REST calls, but I can't find the right one. https://learn.microsoft.com/en-us/rest/api/appservice/

For deployment, I mean every time I make a change to the code and re-deploy the Function App.

I'm using Linux/Python environment.

I tried using this GET:

https://learn.microsoft.com/en-us/rest/api/appservice/webapps/listdeployments#code-try-0

But it returns HTML content like:

<html>
<head>
    <title>Your Azure Function App is up and running.</title>
    <style type="text/css">
        @font-face {
            font-family: 'SegoeLight';
...
...
...

Which looks like this: enter image description here

guidout
  • 322
  • 1
  • 4
  • 13

2 Answers2

0

You need to use kudu rest api for that. specifically the

GET /api/deployments

api path. and then retrieve the latest deployment with

GET /api/deployments/{id}
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • I tried that but I get html content as response, not the typical json content. Do you get the same? Is it supposed to be html content? GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}?api-version=2019-08-01 – guidout Feb 12 '20 at 13:58
  • well, you need to auth as well – 4c74356b41 Feb 12 '20 at 14:01
  • no, you should talk to KUDU, not to ARM rest API. did you actually read the answer? Literally the first sentence on the link I've given says: `the API to get the list of deployments will be https://yoursite.scm.azurewebsites.net/deployments` – 4c74356b41 Feb 12 '20 at 14:08
  • so https://learn.microsoft.com/en-us/rest/api/appservice/webapps/getdeployment will not work? – guidout Feb 12 '20 at 14:11
  • hm, thats weird, didnt know some KUDU api calls are exposed via ARM (and this looks like its that), so whats your html content? that KUDU api just returns JSON – 4c74356b41 Feb 12 '20 at 14:25
  • just added more info in the question – guidout Feb 12 '20 at 14:34
  • works fine for me, returns: `{"value":[]}`. can you try using another browser\incognito mode\another workstation? – 4c74356b41 Feb 12 '20 at 14:47
  • I'm using Postman for testing. Maybe that's not available for Python/Linux deployments? – guidout Feb 12 '20 at 14:55
  • how are you using postman if you are using try-it? you are clearly doing something wrong. use a proper URL to access the rest API, it will work. Linux\Windows doesnt matter. I tested on a linux one as well – 4c74356b41 Feb 12 '20 at 14:57
  • I'm using both. try-it by logging in with the browser and postman getting a bearer token. BUT you know what, I think I'm trying to look at the wrong thing. I need to get the date of the last time I deployed the app. I use VS Code to deploy the app. Is it the right api call? – guidout Feb 12 '20 at 15:06
  • yeah, it should be the right API call. what url are you using? not sure how to reproduce your try-it results, as mine were successful. – 4c74356b41 Feb 12 '20 at 15:33
  • are you trying with a Function App? I tried to pass in the URL the right app name but a wrong deployment id and I get the same result, so I think it doesn't find a deployment "feature" at all – guidout Feb 12 '20 at 16:20
  • I just found in the documentation this: Linux function apps running in the Consumption plan don't have an SCM/Kudu site, which limits the deployment options. However, function apps on Linux running in the Consumption plan do support remote builds. – guidout Feb 12 '20 at 16:31
  • one more insight: when I deploy the app from VS Code I see this message: 11:50:57 AM metrics-min: Uploading built content /home/site/deployments/functionappartifact.squashfs – guidout Feb 12 '20 at 16:55
  • yeah, that seems to be the case, it works for linux app services, but not for consumpition app service plan ones. there's really no kudu behind those. never knew that. because its definitely there for windows ones with the consumption plan – 4c74356b41 Feb 12 '20 at 17:10
0

Unfortunately, it's not supported.

Consumption plan

Linux function apps running in the Consumption plan don't have an SCM/Kudu site, which limits the deployment options. However, function apps on Linux running in the Consumption plan do support remote builds.

https://learn.microsoft.com/bs-latn-ba/azure/azure-functions/functions-deployment-technologies

guidout
  • 322
  • 1
  • 4
  • 13