Home

Access to cross-resource functions from within a function?

%3CLINGO-SUB%20id%3D%22lingo-sub-849223%22%20slang%3D%22en-US%22%3EAccess%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-849223%22%20slang%3D%22en-US%22%3E%3CP%3EStep%201%3A%20Create%20a%20function%20(with%20alias%20'productavailability')%20in%20an%20application%20insights%20instance.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20availabilityResults%20%7C%20where%20name%20%3D%3D%20%22blah%22%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EStep%202%3A%20From%20a%20LA%20workspace%2C%20access%20the%20function%20using%20app('AppId').productavailability.%26nbsp%3B%20It%20works.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStep%203%3A%20Create%20a%20function%20in%20the%20LA%20workspace%20(with%20alias%20'remoteproductavailability').%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStep%204%3A%20Execute%20the%20function.%26nbsp%3B%20Results%20in%20error%3A%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Unknown%20function%3A%20'app'.%20Support%20id%3A%20ccc8637c-53cf-4364-b36b-e8b03bbe104b%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdditional%20information%20-%20I%20can%20wrap%20a%20remote%20%22table%22%20(availabilityResults)%20in%20the%20function%20and%20it%20has%20no%20issue%20with%20the%20app().table%26nbsp%3Bsyntax.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20suggestions%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-849223%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-849588%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-849588%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F79899%22%20target%3D%22_blank%22%3E%40Michael%20Faulkinbury%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20can%20you%20share%20the%20function%20code%20(or%20an%20edit)%20from%20Step3%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-853304%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-853304%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20reply.%20Sure.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3E%2F%2F%20definition%20saved%20with%20alias%20'allproductmvp'%20%0Aunion%20withsource%3D%20SourceApp%0Aapp('5c657003-fc6a-4a63-99f9-3608ab4bd293').productmvp%2C%0Aapp('23bdf41b-38c2-4292-b960-35a613c777f6').productmvp%0A%2F%2F%20end%20definition%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%3CSPAN%3EI%20can%20run%20the%20statement%20(function%20body)%20just%20fine%2C%20but%20when%20I%20try%20to%20run%20the%20function%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Eallproductmvp%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3CSPAN%3E...it%20results%20in%20the%20error%20posted.%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-853321%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-853321%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F79899%22%20target%3D%22_blank%22%3E%40Michael%20Faulkinbury%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20doubt%20it's%20this%20but%20you%20can%20try%20an%20isfuzzy%3Dtrue%20in%20case%20one%2Fboth%20the%20the%20workspaces%20isn't%20available%20-%20I'll%20try%20and%20take%20a%20deeper%20look%20tomorrow.%26nbsp%3B%20e.g.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Eunion%20isfuzzy%3Dtrue%20withsource%20%3D%20SourceApp%0Aworkspace('Fabrikamltdprod').SecurityEvent%2C%20%20%0Aworkspace('contosoretail-IT').SecurityEvent%20%0A%7C%20parse%20SourceApp%20with%20*%20%22('%22%20applicationName%20%22')%22%20*%20%20%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855679%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855679%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3BThanks%20for%20looking%20into%20this%2C%20but%20I%20think%20my%20case%20is%20falling%20under%20a%20known%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EA%20function%20in%20Azure%20Monitor%20cannot%20contain%20another%20function.%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Flog-query%2Ffunctions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Flog-query%2Ffunctions%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20seems%20like%20an%20important%20feature%20in%20order%20to%20avoid%20violations%20of%20the%20DRY%20principle.%26nbsp%3B%20Would%20you%20happen%20to%20know%20if%20this%20is%20on%20the%20product%20backlog%20or%20a%20related%20user%20voice%20item%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-856686%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-856686%22%20slang%3D%22en-US%22%3EI%20will%20ask...thanks%20for%20the%20info%2C%20and%20sorry%20I%20wasn't%20able%20to%20look%20at%20this%20on%20Friday.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-856750%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20to%20cross-resource%20functions%20from%20within%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-856750%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F79899%22%20target%3D%22_blank%22%3E%40Michael%20Faulkinbury%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGood%20news%2C%20this%20just%20back%20from%20the%20product%20group...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%22This%20feature%20is%20work%20in%20progress%20and%20should%20be%20released%20in%20the%20next%20week%20or%20so%22%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'll%20keep%20you%20updated%20if%2Fwhen%20I%20hear%20more.%26nbsp%3B%20Thanks%20Clive%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Michael Faulkinbury
Occasional Contributor

Step 1: Create a function (with alias 'productavailability') in an application insights instance.

            availabilityResults | where name == "blah"

Step 2: From a LA workspace, access the function using app('AppId').productavailability.  It works.
Step 3: Create a function in the LA workspace (with alias 'remoteproductavailability').  
Step 4: Execute the function.  Results in error:
            Unknown function: 'app'. Support id: ccc8637c-53cf-4364-b36b-e8b03bbe104b

 

Additional information - I can wrap a remote "table" (availabilityResults) in the function and it has no issue with the app().table syntax.

 

Any suggestions appreciated.

6 Replies

@Michael Faulkinbury 

 

Please can you share the function code (or an edit) from Step3?

@Clive Watson Thanks for your reply. Sure.

 

 

// definition saved with alias 'allproductmvp' 
union withsource= SourceApp
app('5c657003-fc6a-4a63-99f9-3608ab4bd293').productmvp,
app('23bdf41b-38c2-4292-b960-35a613c777f6').productmvp
// end definition

 

 
I can run the statement (function body) just fine, but when I try to run the function:

 

allproductmvp

 

 ...it results in the error posted.

@Michael Faulkinbury 

 

I doubt it's this but you can try an isfuzzy=true in case one/both the the workspaces isn't available - I'll try and take a deeper look tomorrow.  e.g. 

 

union isfuzzy=true withsource = SourceApp
workspace('Fabrikamltdprod').SecurityEvent,  
workspace('contosoretail-IT').SecurityEvent 
| parse SourceApp with * "('" applicationName "')" *  

 

@Clive Watson Thanks for looking into this, but I think my case is falling under a known issue.

 

A function in Azure Monitor cannot contain another function.

https://docs.microsoft.com/en-us/azure/azure-monitor/log-query/functions

 

This seems like an important feature in order to avoid violations of the DRY principle.  Would you happen to know if this is on the product backlog or a related user voice item?

I will ask...thanks for the info, and sorry I wasn't able to look at this on Friday.

@Michael Faulkinbury 

 

Good news, this just back from the product group...

 

"This feature is work in progress and should be released in the next week or so"

 

I'll keep you updated if/when I hear more.  Thanks Clive

Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies