I have manually deployed a WAR (on Tomcat) containing the implementation of a REST API which exposes a Swagger 2.0 end point. The REST API is developed using the Restlet framework in Java. The folder structure on the app host looks like the following:
/site/wwwroot/webapps/myapp.war
/site/wwwroot/apiapp.json
The content of apiapp.json is:
{
"$schema": "http://json-schema.org/schemas/2014-11-01/apiapp.json#",
"id": "myapp.apiapp",
"namespace": "<myusername>.onmicrosoft.com",
"gateway": "2015-01-14",
"version": "1.0.0",
"title": "Title",
"summary": "",
"author": "Author",
"endpoints": {
"apiDefinition": "/myapp/api-docs",
"status": null
}
}
I am able to get the swagger json by navigating to https://<myapphost>.azurewebsites.net/myapp/api-docs
However when I attempt to view the API definition on Azure Portal I see a blank table and then get the following error:
The gateway did not receive a response from 'Microsoft.AppService' within the specified time period.
Operator error :-)
I thought I was serving up Swagger 2.0 while in reality I still had the old Swagger 1.2 being served up. After updating the spec to Swagger 2.0 I can now see the definitions being listed on the Azure portal. I wish the error was more meaningful than a 'gateway timeout'!
Related
How can I list a SharePoint site's drives using the Graph API for GCC High environments? It works when using the same endpoint in my standard environment. I'm able to list all of the drives. However, in my client's GCC High environment, with the same exact API Permissions on the App Registration in Azure, I can't get it to list anything. It just returns an empty array with a 200 status.
Graph API Endpoint:
https://graph.microsoft.us/v1.0/sites/{{site-id}}/drives
Response:
{
"#odata.context": "https://graph.microsoft.us/v1.0/$metadata#drives",
"value": []
}
API Permissions
This endpoint will return the site's metadata however:
https://graph.microsoft.us/v1.0/sites/{{site-id}}
{
"#odata.context": "https://graph.microsoft.us/v1.0/$metadata#sites/$entity",
"createdDateTime": "2022-10-05T17:42:12.63Z",
"description": "",
"id": "{{site-id}}",
"lastModifiedDateTime": "2022-10-06T10:13:56Z",
"name": "DocumentCenter",
"webUrl": "{{site-url}}",
"displayName": "{{site-name}}",
"root": {},
"siteCollection": {
"hostname": "{{host-name}}"
}
}
After speaking with a Microsoft support specialist I found that my "Grant Type" within my Authorization settings in Postman were incorrect. I was using an Authorization Code, and I needed to use Client Credentials. My App Registration had Application permissions, not Delegated for the SharePoint permissions. So the call was not authorized to return SharePoint lists until I switched to the Client Credential Grant Type.
Summary:
When attempting to deploy a Microsoft Teams Node.JS project written in typescript to Azure servers the Teams application throws an error "There was a problem reaching this app." The application works fine when opening in a browser but is not recognized in Teams. It appears that all the manifest is setup correctly and when run in the verification of App Studio no errors are returned.
Attempted Solutions:
Attempted to match the manifest with examples given by Microsoft. Attempted to get a Microsoft teams application deployed to Azure using the examples shared by Microsoft.
Code:
Teams App Manifest:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
"manifestVersion": "1.7",
"id": "dfe1fc96-d4db-4ed4-b76a-c26194928313",
"version": "1.0.0",
"packageName": "messageleapteams",
"developer": {
"name": "Real Data Consulting",
"websiteUrl": "https://messageleapteams.azurewebsites.net",
"privacyUrl": "https://messageleapteams.azurewebsites.net/privacy.html",
"termsOfUseUrl": "https://messageleapteams.azurewebsites.net/tou.html"
},
"name": {
"short": "messageLeapTeams",
"full": "messageLeapTeams"
},
"description": {
"short": "TODO: add short description here",
"full": "TODO: add full description here"
},
"icons": {
"outline": "icon-outline.png",
"color": "icon-color.png"
},
"accentColor": "#D85028",
"configurableTabs": [
{
"configurationUrl": "https://messageleapteams.azurewebsites.net/messageLeapTeamsTab/config.html?name={loginHint}&tenant={tid}&group={groupId}&theme={theme}",
"canUpdateConfiguration": true,
"scopes": [
"team"
]
}
],
"staticTabs": [],
"bots": [],
"connectors": [],
"composeExtensions": [],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"messageleapteams.azurewebsites.net"
],
"showLoadingIndicator": true,
"isFullScreen": false,
"webApplicationInfo": {
"id": "dfe1fc96-d4db-4ed4-b76a-c26194928313",
"resource": "api://messageleapteams.azurewebsites.net/dfe1fc96-d4db-4ed4-b76a-c26194928313"
}
}
It turns out the web application was properly deployed and the manifest built correctly, however with teams tab applications hosted in Azure the loading indicator must be disabled.
I fixed this issue by setting "showLoadingIndicator": false in the manifest.json
In my opinion, if you can ensure there is no error with your code, you can check your configuration.
Next description are based on the c# sample (conversation bot)that Ms provided. And I think nodejs is similar.You can click the link and see the detail.
you have to create an Azure Ad app with client secret, and modify the 'appsetting' file to make sure the code can run in local.
ngrok is needed so you can visit your code running in local.
pls create a bot on Azure portal, enter correct appId, client secret(created in setp 1) and Messaging endpoint(get the https url after starting the ngrok,and don't forget to append '/api/messages' after the url)
now you can test your code running in local environment in web chat.
if you want to test in Teams client, you need to modify 'manifest.json' and create a ZIP file and upload your bot to Teams. Then you have to add the Teams channel in the bot created in step 3.
enter image description here
Please note if the Azure AD application created in step 1 belongs to a tenant which is different from your Teams login account's tenant, you should set the app as a multi-tenant app(when you create an app, it will ask you to choose whom are allowed to visit this app).
If there is no problem running the program locally, it will be fine after deploying to azure app service.
I am trying to import OpenAPI specs json largely similar to https://github.com/ccouzens/keycloak-openapi/blob/master/keycloak/9.0.json on my azure api management service.
I validated my version of the openapi.json on
http://editor.swagger.io/
.
When I try creating API resources using the above json I get the Error :
{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"templateParameters","message":"All template parameters used in the UriTemplate must be defined in the Operation, and vice-versa."}]}}
please help
Found the Issue. The json API spec file has multiple API URLs with {id} occurring twice in the same URL ,which azure's API management doesn't allow, and there is no "parameter" definition for two path parameters.
For example , refer below URL and corresponding parameter definition in the api spec file
/{realm}/client-scopes/{id}/protocol-mappers/models/{id}
"parameters": [
{
"in": "path",
"name": "realm",
"description": "realm name (not id!)",
"required": true,
"schema": {
"type": "string"
},
"style": "simple"
},
{
"in": "path",
"name": "id",
"description": "Mapper id",
"required": true,
"schema": {
"type": "string"
},
"style": "simple"
}
]
swagger editor does not consider these constrain violations
So, to sum up, for uploading open API spec on Azure api management service, you need to consider following constrains along with the ones that is present in the azure docs
you cannot have two path parameters with same identification string
all path parameters should have a "parameter" definition in the spec json
PS : My api spec json was largely similar to the json file, but not the same. It has other issues like delete API with a request body.
Last week I've been looking at Bot framework Samples, honestly BotFx isn't my area of expertise.
I was playing with these samples from the sample library:
18.bot-authentication
24.bot-authentication-msgraph
46.teams-auth
The required steps for making work each of them are almost the same, for #18 and make it work in the emulator this include:
Register the BotApp in Azure AD
Generate a Secret
Add the Redirect URI (as documented it should be: https://token.botframework.com/.auth/web/redirect)
Create an azure bot service
Customize the OAuth Connection Settings
Then in the solution Modify appsettings.json (sample values below)
{
"ConnectionName": "juank",
"MicrosoftAppId": "cee1234562074c-1b3e-49b4-9e76-b727d73453454e018d",
"MicrosoftAppPassword": "uxPdfgwo.JAYmgrtU]w5I7KdgxLZSJ.a[qtgtrFxYZ02"
}
After that It's required to run the emulator and configure the
following settings
Up to this point the bot works as expected
Then I type any... and it just doesn't work. I receive this answer
from the bot :
And this data from the trace Operation returned an invalid status
code 'Unauthorized'
{
"channelId": "emulator",
"conversation": {
"id": "77631280-22e8-11ea-93e0-6dc9b0b41a7c|livechat"
},
"from": {
"id": "61bab030-214b-11ea-9cf4-193735472c4b",
"name": "Bot",
"role": "bot"
},
"id": "ae429e60-22e8-11ea-9786-a543cb22378b",
"label": "TurnError",
"localTimestamp": "2019-12-20T00:22:13-05:00",
"locale": "en-US",
"name": "OnTurnError Trace",
"recipient": {
"id": "f6982626-923e-4fd3-b930-eabf095e96df",
"role": "user"
},
"replyToId": "aacb51f0-22e8-11ea-9786-a543cb22378b",
"serviceUrl": "https://7eec83e4.ngrok.io",
"timestamp": "2019-12-20T05:22:13.958Z",
"type": "trace",
"value": "Operation returned an invalid status code 'Unauthorized'",
"valueType": "https://www.botframework.com/schemas/error"
}
And that's all.
I've successfully acquired the token from the OAuth setting Test tool in azure portal and also using Postman, but i haven't been able to make these Demos work properly once OAuthCard should be presented for login. Debugging hasn't been helpful since there isn't other information apart from JSON exposed above.
Any guidance or orientation about how to fix this will be appreciated.
There is no need to configure Azure Bot Service configurations in emulator. The Application Id and Application Password should be the same as those in appsettings.
And you should got these values from Azure portal under Configuration part.
Before doing this, please make sure the auth connection works.
Update:
You can change the Microsoft APPId here:
I am using a Classic Web Service with a non-default endpoint for a Update Resource activity on the Azure Data Factory. This is the error I get:
Screenshot of Error
I didn't find any info on the web and couldn't figure it out myself. This website shows an example that I used by just filling in my values for mlEndpoint, apiKey and updateRessourceEndpoint:
{
"name": "updatableScoringEndpoint2",
"properties": {
"type": "AzureML",
"typeProperties": {
"mlEndpoint": "https://ussouthcentral.services.azureml.net/workspaces/xxx/services/--scoring experiment--/jobs",
"apiKey": "endpoint2Key",
"updateResourceEndpoint": "https://management.azureml.net/workspaces/xxx/webservices/--scoring experiment--/endpoints/endpoint2"
}
}
}
There is no mention of a token that needs to be passed...
this error is basically saying the apiKey you provided is invalid to perform the update resource operation. Here is some posts for your reference: https://social.msdn.microsoft.com/Forums/azure/en-US/3bb77e37-8860-43c6-bcaa-d6ebd70617b8/retrain-predictive-web-service-programmatically-when-do-not-have-access-to-managementazuremlnet?forum=MachineLearning
Please also be noted that if you modified your linked service in ADF, remember to re-deploy the pipeline as well to reflect your change in time.