configuration := &graphconfig.EventsRequestBuilderPostRequestConfiguration{
Headers: headers,
}
I am not able to get graphconfig package in go
I have tried different different package like msgraph-sdk-go, azure package etc. but didn't get a package for EventsRequestBuilderPostRequestConfiguration{}
Related
I want to publish my scala project(=multi project) using "stb publish" in my azure devOps Feed Test.
For this purpose I make the settings below as requested.
publishTo := {Some("azure" at "https://pkgs.dev.azure.com/anyTeam/blub12351234154124/_packaging/Test/maven/v1")}
credentials += Credentials("", "pkgs.dev.azure.com", "Username", "5mctdrtasdasdLongAccesstokenwithManyCharacterscytgcg2hlura")
But I always get the message
Unable to find credentials for
[https://pkgsprodsu3weu.app.pkgs.visualstudio.com/ #
pkgs.dev.azure.com]
and logically the authentication fails with
401 Unauthorized
I have already tried to follow the advices in the issues https://github.com/sbt/sbt/issues/5492 and https://github.com/sbt/ivy/pull/36 but without result
I also tested the plugin https://github.com/arktekk/sbt-aether-deploy
I tested different ways to connect to an Azure Artifacts feed using sbt. From all tested combinations, I found exactly one which seems to work. I tested using sbt v1.3.10, which is the latest officially released version at the time of writing.
Define sbt version in build.properties:
sbt.version = 1.3.10
Actually using the Azure Artifacts feed in build.sbt:
// Go back to Apache Ivy for library management.
// Coursier is currently not able to work with Azure Artifacts feeds.
ThisBuild / useCoursier := false
// Specify credentials in a properties file.
// Not 100% sure if I tested hard coded credentials.
// I did test specifying credentials in ~/.m2/settings.xml which did not work
// (but I'm not sure if either Ivy or Coursier are meant to pick them up).
credentials += Credentials(Path.userHome / ".sbt" / "azureArtifactsFeed.credentials")
// Specify the resolver using the following syntax.
// I tested creating an Ivy resolver using Resolver.url() with Resolver.mavenStylePatterns
// (thinking we're using Ivy anyways and it seems to support maven repos), but that failed
// as well (again, I'm not 100% sure if that's supposed to work in the first place).
resolvers += "SOME_NAME" at
"https://pkgs.dev.azure.com/ORGANIZATION/FEED_UUID/_packaging/FEED_NAME/maven/v1"
// With the setup so far, we should already be able to consume artifacts.
// Now for the publishing part:
publishTo := Some("SOME_NAME" at
"https://pkgs.dev.azure.com/ORGANIZATION/FEED_UUID/_packaging/FEED_NAME/maven/v1")
And last but not least, it's important to keep the realm empty in the properties file for the credentials.
So in ~/.sbt/azureArtifactsFeed.credentials:
realm=
host=pkgs.dev.azure.com
user=ORGANIZATION
password=USER_TOKEN_WITH_PACKAGING_READ_AND_WRITE_SCOPE
If (perhaps) you are using cross compiled projects (using sbt-crossproject), you'd have to add the credentials to the settings of the project you want to publish like this:
lazy val myProject = crossProject(JSPlatform, JVMPlatform).in(file("."))
.settings(
organization := "com.example",
name := "my project name",
credentials += Credentials("", "pkgs.dev.azure.com", "Username", "5mctdrtasdasdLongAccesstokenwithManyCharacterscytgcg2hlura")
// ...
)
This seems to be a bug with SBT. Reference: https://github.com/sbt/sbt/issues/5492
I was able to make it work using the sbt plugin: https://github.com/arktekk/sbt-aether-deploy
For JDK8 use (you could try newer version with JDK11)
addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.26.0")
This is how my build.sbt looks:
publishMavenStyle := true,
publishTo := {
val url = "https://pkgs.dev.azure.com/XXX/YYY/_packaging/ZZZ/maven/v1/"
Some("snapshots" at url)
},
credentials += Credentials("", "pkgs.dev.azure.com", "XXXX",
"YYYYYYY")
To publish remotely: sbt aetherDeploy
API Name:
TextModerator
have Azure Subscription and I created the cognitive service, and from a c# console, I'm trying to test the TextModerator project.
When this line is called:
var screenResult =
client.TextModeration.ScreenText("text/plain", new MemoryStream(Encoding.UTF8.GetBytes(text)), "eng", true, true, null, true);
I got the following message:
Microsoft.CognitiveServices.ContentModerator.Models.APIErrorException
: 'Operation returned an invalid status code 'NotFound''
the endpoint is like this:
https://contentmoderator-****.cognitiveservices.azure.com/contentmoderator
Any Idea?
Saad
You can use the following base endpoint for your specific Region(ex:westus).
https://westus.api.cognitive.microsoft.com.
Install the client library:
Within the application directory, install the Content Moderator client library for .NET with the following command:
dotnet add package Microsoft.Azure.CognitiveServices.ContentModerator --version 2.0.0
If you're using the Visual Studio IDE, the client library is available as a downloadable NuGet package.
Please follow the below document for Moderate Text.
https://learn.microsoft.com/en-us/azure/cognitive-services/content-moderator/dotnet-sdk-quickstart#setting-up
Please follow the API Reference for more information.
I have included a NuGet Package in an Azure Function app that I downloaded to work on in Visual Studio. I have added it to the project.json and I still get "error CS0246: The type or namespace name 'NetTopologySuite' could not be found (are you missing a using directive or an assembly reference?)". I've read through microsoft's documentation and cannot find what I could be doing wrong.
Here is a sample of what my csx looks like:
#r "System.Data"
using System;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using NetTopologySuite;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
\\ Code to retrieve data from database and turn it into an array
\\ of GeoJSON features called DataFromDatabase not shown
NetTopologySuite.Features.Feature[] TrailSegments = DataFromDatabase;
HttpResponseMessage resp = req.CreateResponse(HttpStatusCode.OK);
resp.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(DataFromDatabase), System.Text.Encoding.UTF8, "application/json");
return resp;
}
Here is my project.json:
{
"frameworks": {
"net46": {
"dependencies": {
"NetTopologySuite.IO.GeoJSON": "1.14.0"
}
}
}
}
Does anyone have more experience with this that could offer a little more than what's in the documentation?
"FUNCTIONS_EXTENSION_VERSION": "~1"
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0"
If you do upload the project.json file to your function folder(not function app folder), what you have done is exactly right. I have followed your steps and things work fine on my side.
Nuget restoring for function editable online is not so sensitive, so you may wait for a while(you can do some edit in function code and click save or directly restart whole function app).
After that, you can see a project.lock.json under the function folder. It means the package has been installed successfully. Then everything goes well.
Update for multiple functions sharing reference.
One function package restore can't be used by others. So we have to upload dlls manually if you don't want to add project.json to every function. See shared assemblies.
Download NetTopologySuite.IO.GeoJSON.
Find four dlls(NetTopologySuite.dll/NetTopologySuite.IO.GeoJSON.dll/GeoAPI.dll/PowerCollections.dll) in package and upload them to a bin folder under function app folder.
Add four assemblies in code like #r "..\bin\NetTopologySuite.IO.GeoJSON.dll". You may also need add #r "Newtonsoft.Json" as it's one dependency in that package.
If you use the dll with namespace like NetTopologySuite.Features.Feature[], you don't have to import namespaces. And vice versa.
If you know those dependencies clearly, you can only upload and reference dlls you need.
I see that you are using 3rd party library which is widely available in Nuget official repository. In such cases, you need to let Azure know which Nuget repository your package, 'NetTopologySuite' resides in..
Github: https://github.com/NetTopologySuite/NetTopologySuite
NuGet v3: https://www.myget.org/F/nettopologysuite/api/v3/index.json
NuGet v2: https://www.myget.org/F/nettopologysuite/api/v2
Create Nuget.config file
Add the following contents in that file and re-configure it for your environment.
Nuget.config content - you can find exhaustive file online.
Im writing an azure function to generate a JWT token and return it to the client. The code is tested locally in a console app and all seems to work fine. This is the package reference included in the working console app, and in my functions app:
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.1" />
When running the function host locally with func host start and executing the code it results in the error:
Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."
I don't understand why this is happening, the dll is laying in the output folder along with my application dll. The only other thing I can think of is that the function host has its own set of packages that it sources from and this one is not available yet, having been only released 12 days ago.
I'm not sure. Any help on why this is happening or how to get around it?
Details:
Azure Functions Core Tools (2.0.1-beta.22)
Function Runtime Version: 2.0.11415.0
I got this issue and it seems to be related to some kind of bug in the Azure function SDK. the fix was to add:
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
to your csproj file. As documented here
I had installed this package Microsoft.AspNetCore.Authentication.JwtBearer
And for me, the issue was resolved.
You can uninstall System.IdentityModel.Tokens.Jwt
Because the Microsoft package depends on the system package, so it gets installed automatically.
I was able to solve this exact issue by using an older version of the nuget package. My starting point was that I had copied a class file from an old project to a new one. The class file referenced JwtSecurityToken. This did not compile in the new project, so I added Security.IdentityModel.Tokens.Jwt from nuget package manager. I just added latest version. This worked fine locally, but just like you, it failed when published to azure. I then looked at the old project and noticed that it was using 5.1.4 of that Security.IdentityModel.Tokens.Jwt. So, I downgraded to that version and it now works when published.
fwiw: this is the v2 preview runtime version at the time I did this.
https://<mysite>.azurewebsites.net/admin/host/status?code=<myadminkey>
{
"id": "<mysite>",
"state": "Running",
"version": "2.0.11587.0",
"versionDetails": "2.0.11587.0-beta1 Commit hash: 1e9e7a8dc8a68a3eff63ee8604926a8d3d1902d6"
}
tl;dr
None of the above worked for me and this would randomly happen from time to time until today it happened all the time. The only reason I could see was that Microsoft.IdentityModel.Tokens was not directly referenced in the executing project, but was on a referenced project. The library was sitting in the bin folder, it just wouldn't load.
Reference
Taking a clue from this solution to another problem I was able to resolve it like so:
Solution
Create a static constructor in the app's entry point class
static MainClass()
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
Add the handler
private static System.Reflection.Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
{
var domain = sender as AppDomain;
var assemblies = domain.GetAssemblies();
foreach(var assembly in assemblies)
{
if (assembly.FullName.IsEqualTo(args.Name))
{
return assembly;
}
}
var folder = AppDomain.CurrentDomain.BaseDirectory;
var name = args.GetLibraryName().Name.Split(Symbols.Comma).FirstOrDefault();
var library = $"{name}.dll";
var file = Path.Combine(folder, library);
if (File.Exists(file))
{
return Assembly.LoadFrom(file);
}
return null;
}
I have a service set up that uses ServiceStack.Swagger.Api. My service has several endpoints that support OPTIONS requests. Is there a way to configure the SwaggerAPI plugin to add 'options' to the js SwaggerUi.supportedSubmitMethods list in the index.html?
The options requests shows but the 'Try It Out' button does not exists because the supportedSubmitMethods doesn't have options in it.
*Using ServiceStack 4.5.6
ServiceStack Swagger's embedded resource files are overridable using the Virtual File System so you can override Swagger UI's default index.html by taking a copy of index.html and adding it to your Host Project in the /swagger-ui/ folder, e.g:
/swagger-ui/index.html
Then modify your local copy of supportedSubmitMethods to include options, e.g:
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
supportedSubmitMethods:['get', 'post', 'put', 'delete', 'patch', 'options'],
...
Note in the latest v4.5.8 Release if you have a lot of OPTIONS Services you can add it to the list of default verbs for Routes that don't explicitly specify an HTTP Verbs with:
Plugins.Add(new SwaggerFeature
{
AnyRouteVerbs = { HttpMethods.Options },
});
Also if you're able to upgrade to v4.5.8 then you may want to consider switching to use the newer Open API Feature which implements v2.0 of the Open API specification which is the successor to Swagger.