web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Calling Azure Resource...
Power Automate
Unanswered

Calling Azure Resource Manager API in Flow - "statusCode": 404, "message": "Resource not found"

(0) ShareShare
ReportReport
Posted on by 34

Hi,

 

I’m using the same principle as described in Create a custom API using Azure Resource Manager in Microsoft Flow to Start/Stop an Azure Resource Manager Virtual Machine via Microsoft Flow.

 

When I register the swagger file as a custom API and create a new flow to use the Start/PowerOff actions,

The VM gets started/stopped properly like expected, but I get also a HTTP 404 error:

 

    "statusCode": 404, "message": "Resource not found"

 

The questions is how can I get more details about what is going wrong here? Or what is the reason behind this HTTP 404 ?

 

Screen capture: shows the 404 error code in the body of the output

Error 404 - Resource not foundError 404 - Resource not found

 

Screen capture: shows that i.e. the PowerOff operation is available on the designer

 

Flow element.jpg

 

Swagger file content - Only a part of swagger file is documented here to maintain the readability:

 

	 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/start": {
 "post": {
			"description": "Starts a given Virtual Machine",
			"summary": "Starts a given Virtual Machine",
			"operationId": "StartRmVM",
			"x-ms-visibility": "important",		
			"parameters": [
				{
				 "name": "api-version",
				 "x-ms-summary": "API version",
				 "in": "query",
				 "description": "API version",
				 "required": true,
				 "type": "string",
				 "default": "2016-03-30"
				},
				{
				 "name": "subscriptionId",
				 "in": "path",
				 "required": true,
				 "type": "string"
				},
				{
				 "name": "resourceGroupName",
				 "in": "path",
				 "required": true,
				 "type": "string"
				},
				{
				 "name": "virtualMachineName",
				 "in": "path",
				 "required": true,
				 "type": "string"
				}			
			],
			"responses": {
			 "200": {
				"description": "OK"
			 },
			 "400": {
				"description": "Bad Request"
			 },
			 "500": {
				"description": "Internal Server Error"
			 },
			 "default": {
				"description": "Operation Failed."
			 }
			}	
		 }
	 }
Categories:
I have the same question (0)
  • Jaden Profile Picture
    Microsoft Employee on at

    @MehrdadG Sorry you are seeing issues with this.

     

    404 means Flow cannot reach the endpoint you specified. Have you made any changes to the Custom API template prior to uploading it on the Flow web site?

     

    Also, can you please share te Flow name/ID? This can be done by editing your Flow on the Flow page and pasting the URL here on this thread.

     

    Thanks!

    Jade

  • mehrdadg Profile Picture
    34 on at

    Hi Jaden,

    This is the full version of the swagger file I'm using to try it out,

     

    Error detail:

    OUTPUTS
    Headers
    {
     "Date": "Wed, 04 Jan 2017 07:15:58 GMT",
     "Server": "Microsoft-HTTPAPI/2.0",
     "Content-Length": "54",
     "Content-Type": "application/json"
    }
    Body
    {
     "statusCode": 404,
     "message": "Resource not found"
    }

     

    Swagger file I'm using:

    {
     "swagger": "2.0",
     "info": {
     "version": "1.0",
     "title": "ARM Sample",
     "description": "Access Azure Resources using this API to turn on/off a ARM Virtual Machine", 
     "contact": {
     "name": "sample",
     "email": "sample@non-existing.com"
     }
     },
     "host": "management.azure.com",
     "basePath": "/",
     "schemes": [
     "https"
     ],
     "consumes": [
     "application/json"
     ],
     "produces": [
     "application/json"
     ],
     "securityDefinitions": {
     "AAD": {
     "type": "oauth2",
     "flow": "implicit",
     "authorizationUrl": "https://login.windows.net/common/oauth2/authorize",
     "scopes": {}
     }
     },
     "paths": {
    	 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/start": {
     "post": {
    			"description": "Starts a given Virtual Machine",
    			"summary": "Starts a given Virtual Machine",
    			"operationId": "StartRmVM",
    			"x-ms-visibility": "important",		
    			"parameters": [
    				{
    				 "name": "api-version",
    				 "x-ms-summary": "API version",
    				 "in": "query",
    				 "description": "API version",
    				 "required": true,
    				 "type": "string",
    				 "default": "2016-03-30"
    				},
    				{
    				 "name": "subscriptionId",
    				 "in": "path",
    				 "required": true,
    				 "type": "string"
    				},
    				{
    				 "name": "resourceGroupName",
    				 "in": "path",
    				 "required": true,
    				 "type": "string"
    				},
    				{
    				 "name": "virtualMachineName",
    				 "in": "path",
    				 "required": true,
    				 "type": "string"
    				}			
    			],
    			"responses": {
    			 "200": {
    				"description": "OK"
    			 },
    			 "400": {
    				"description": "Bad Request"
    			 },
    			 "500": {
    				"description": "Internal Server Error"
    			 },
    			 "default": {
    				"description": "Operation Failed."
    			 }
    			}	
    		 }
    	 },
    	 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/powerOff": {
     "post": {
    			"description": "PowerOff a given Virtual Machine",
    			"summary": "PowerOff a given Virtual Machine",
    			"operationId": "PowerOffRmVM",
    			"x-ms-visibility": "important",		
    			"parameters": [
    				{
    				 "name": "api-version",
    				 "x-ms-summary": "API version",
    				 "in": "query",
    				 "description": "API version",
    				 "required": true,
    				 "type": "string",
    				 "default": "2016-03-30"
    				},
    				{
    				 "name": "subscriptionId",
    				 "in": "path",
    				 "required": true,
    				 "type": "string"
    				},
    				{
    				 "name": "resourceGroupName",
    				 "in": "path",
    				 "required": true,
    				 "type": "string"
    				},
    				{
    				 "name": "virtualMachineName",
    				 "in": "path",
    				 "required": true,
    				 "type": "string"
    				}			
    			],
    			"responses": {
    			 "200": {
    				"description": "OK"
    			 },
    			 "400": {
    				"description": "Bad Request"
    			 },
    			 "500": {
    				"description": "Internal Server Error"
    			 },
    			 "default": {
    				"description": "Operation Failed."
    			 }
    			}	
    		 }
    	 } 
     }
    }
  • v-yamao-msft Profile Picture
    on at

    Hi MehrdadG,

     

    Thanks for the full version of the Swagger file. Could you also please provide your Flow Name and your Flow ID for a further investigation?

     

    Best regards,
    Mabel Mao

  • Jaden Profile Picture
    Microsoft Employee on at

     

    From the looks of it this probably means the params specified (e.g. resourceGroupName, subscriptionId, etc.) are leading to an invalid URL thus the 404 error.

     

    The only way we can confirm this issue for you is if we have some identifiers for the Flow (e.g. Flow ID) itself so we can investigate on our end.

     

    Thank you,

    Jade

  • mehrdadg Profile Picture
    34 on at

    Hi,

     

    Sorry about the long delay in between.

     

    Here is the Url to the flow editor:

     

    https://flow.microsoft.com/manage/environments/201481f5-c2da-4d1a-8f87-4c5ca33bca80/flows/aa698f76-8732-42d6-bb8d-f3a17388ebd3

     

    Hope this helps for further follow-up as the issue is still the same.

     

    Please let me know if you need any additional details

    ..Thanks!

     

    Kind regards,

    MehrdadG

  • mehrdadg Profile Picture
    34 on at

    Any update on this subject?

     

    Was the provided information sufficient? Is there anything more visible from backend logging why the HTTP 404 is occuring?

     

    Kind regards,

    MehrdadG

  • Sunay Profile Picture
    on at

    Hi @MehrdadG seems like the error is coming from the ARM APIs themselves. What you can do though is, inspect the request being made through the Flow using the "Test" Tab on the Custom API expereince.

     

    More information on how to test your custom API is in this blog post : https://ms.flow.microsoft.com/en-us/blog/new-updates-custom-api/

     

    Please let me know if this works for you, if not - I can try to debug this on our side.

     

    Thanks,

    Sunay

     

  • Pawel Profile Picture
    on at

    @MehrdadG Also in the swagger of your Custom API try specifying apiVersion as "2016-04-30-preview", according to the docs that's the latest version: https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-start 

  • asifip Profile Picture
    6 on at

    Hi MehrdadG,

     

    Can you check your link, it seems there is an error that indicates unavailability. It would be a great help if you could fix this.

     

    ref - https://flow.microsoft.com/manage/environments/201481f5-c2da-4d1a-8f87-4c5ca33bca80/flows/aa698f76-8732-42d6-bb8d-f3a17388ebd3

     

     

    THanks

    Asif

  • weskroesbergen Profile Picture
    2 on at

    Hi folks,

     

    I too am having this issue. What's weird is that I can see the calls to ARM actually succeed in the Azure activity logs. I also built a custom connector and added actions for start/stopping resources. These calls return a 202 in the Flow Connector Test tab, but a 404 when actually called by a flow (though again, the action actually succeeds and the resource starts / stops in Azure as requested).

     

    I also tried adding handling for 404 and 202 response codes, and they do not seem to fire.

     

    Edit: I am also using 2016-04-30-preview as my API version.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard