Serverless-microservices-reference-architecture | reference architecture walks | Azure library
kandi X-RAY | Serverless-microservices-reference-architecture Summary
Support
Quality
Security
License
Reuse
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
Serverless-microservices-reference-architecture Key Features
Serverless-microservices-reference-architecture Examples and Code Snippets
Trending Discussions on Azure
Trending Discussions on Azure
QUESTION
I am deploying an Azure Function called "Bridge" to Azure, targeting .NET 6. The project is referencing a class library called "DBLibrary" that I wrote, and that library is targeting .NET Standard 2.1. The Azure Function can be run locally on my PC without runtime errors.
When I publish the Azure Function to Azure, I see in Azure Portal a "Functions runtime error" which says:
Could not load file or assembly 'System.ComponentModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
I do not target System.ComponentModel directly, and I don't see a nuget package version 6.0.0 for "System.ComponentModel" available from any nuget feed. Why is the Azure function looking for this version 6.0.0 of System.ComponentModel? If that version does exist, why can't the Azure Function find it?
Here are the relevant parts of the csproj for the "Bridge" Azure Function:
net6.0
v4
Here are the relevant sections of the csproj for the "DBLibrary" class library that is referenced by the Azure Function project:
netstandard2.1
Library
I have tried setting _FunctionsSkipCleanOutput to true in the Azure Functions csproj because that was offered as a potential solution to nuget package resolution issues here: https://github.com/Azure/azure-functions-host/issues/7061 That solution did not change the runtime error I saw in the Azure portal.
ANSWER
Answered 2022-Feb-25 at 10:33The .net standard you are using 2.1
but ,Microsoft.Azure.Functions.Extensions
can be support upto .NET Standard 2.0
You should add the below package to your function app and deploy to Azure again.
dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 5.0.0-rc.2.20475.6
Please refer this GitHub issue and this MICROSOFT BLOG by @Jeremy for more information.
QUESTION
I'm trying to understand how the price estimation works for Azure Data Factory from the official guide, section "Estimating Price - Use Azure Data Factory to migrate data from Amazon S3 to Azure Storage
I managed to understand everything except the 292 hours that are required to complete the migration.
Could you please explain to me how did they get that number?
ANSWER
Answered 2022-Feb-15 at 03:46Firstly, feel free to submit a feedback here with the MS docs team to clarify with an official response on same.
Meanwhile, I see, as they mention "In total, it takes 292 hours to complete the migration" it would include listing from source, reading from source, writing to sink, other activities, other than the data movement itself.
If we consider approximately, for data volume of 2 PB and aggregate throughput of 2 GBps would give
2PB = 2,097,152 GB BINARY and Aggregate throughput = 2BGps --> 2,097,152/2 = 1,048,576 secs --> 1,048,576 secs / 3600 = 291.271 hours
Again, these are hypothetical. Further you can refer Plan to manage costs for Azure Data Factory and Understanding Data Factory pricing through examples.
QUESTION
What specific syntax or configuration changes must be made in order to resolve the error below in which terraform is failing to create an instance of azuread_application
?
THE CODE:
The terraform code that is triggering the error when terraform apply
is run is as follows:
variable "tenantId" { }
variable "clientId" { }
variable "clientSecret" { }
variable "instanceName" { }
terraform {
required_providers {
azuread = {
source = "hashicorp/azuread"
version = "2.5.0"
}
}
}
provider "azuread" {
tenant_id = var.tenantId
client_id = var.clientId
client_secret = var.clientSecret
}
resource "azuread_application" "appRegistration" {
display_name = var.instanceName
app_role {
allowed_member_types = ["User", "Application"]
description = "Admins can manage roles and perform all task actions"
display_name = "Admin"
enabled = true
id = "1b19509b-32b1-4e9f-b71d-4992aa991967"
value = "admin"
}
}
THE ERROR:
The error and log output that result from running the above code with terraform apply
are:
2021/10/05 17:47:18 [DEBUG] module.ad-admin.azuread_application.appRegistration:
apply errored, but we're indicating that via the Error pointer rather than returning it:
Could not create application: json.Marshal():
json: error calling MarshalJSON for type msgraph.Application:
json: error calling MarshalJSON for type *msgraph.Owners: marshaling Owners: encountered DirectoryObject with nil ODataId
2021/10/05 17:47:18 [TRACE] EvalMaybeTainted: module.ad-admin.azuread_application.appRegistration encountered an error during creation, so it is now marked as tainted
2021/10/05 17:47:18 [TRACE] EvalWriteState: removing state object for module.ad-admin.azuread_application.appRegistration
2021/10/05 17:47:18 [TRACE] EvalApplyProvisioners: azuread_application.appRegistration has no state, so skipping provisioners
2021/10/05 17:47:18 [TRACE] EvalMaybeTainted: module.ad-admin.azuread_application.appRegistration encountered an error during creation, so it is now marked as tainted
2021/10/05 17:47:18 [TRACE] EvalWriteState: removing state object for module.ad-admin.azuread_application.appRegistration
2021/10/05 17:47:18 [TRACE] vertex "module.ad-admin.azuread_application.appRegistration": visit complete
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.output.application_id (expand)" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.azuread_service_principal.appRegistrationSP" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "output.application_id" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.output.appId (expand)" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.azuread_service_principal_password.appRegistrationSP_pwd" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "output.appId" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.azurerm_role_assignment.appRegistrationSP_role_assignment_vault" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.azurerm_role_assignment.appRegistrationSP_role_assignment" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.provider[\"registry.terraform.io/hashicorp/azuread\"] (close)" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin.provider[\"registry.terraform.io/hashicorp/azurerm\"] (close)" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "module.ad-admin (close)" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2021/10/05 17:47:18 [TRACE] dag/walk: upstream of "root" errored, so skipping
2021/10/05 17:47:18 [TRACE] statemgr.Filesystem: creating backup snapshot at terraform.tfstate.backup
2021/10/05 17:47:18 [TRACE] statemgr.Filesystem: state has changed since last snapshot, so incrementing serial to 391
2021/10/05 17:47:18 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2021/10/05 17:47:18 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
Error: Could not create application
on ..\..\..\..\modules\ad-admin\active-directory.tf line 69, in resource "azuread_application" "appRegistration":
69: resource "azuread_application" "appRegistration" {
json.Marshal(): json: error calling MarshalJSON for type msgraph.Application:
json: error calling MarshalJSON for type *msgraph.Owners: marshaling Owners:
2021/10/05 17:47:18 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate
encountered DirectoryObject with nil ODataId
terraform -version
gives:
Terraform v1.0.8 on windows_amd64
ANSWER
Answered 2021-Oct-07 at 18:35This was a bug, reported as GitHub issue:
The resolution to the problem in the OP is to upgrade the version from 2.5.0
to 2.6.0
in the required_providers
block from the code in the OP above as follows:
terraform {
required_providers {
azuread = {
source = "hashicorp/azuread"
version = "2.6.0"
}
}
}
QUESTION
I want to generate User Delegation SAS Token to read the Azure BLOB I know we have to follow below step to get it.
- Get the oAuth Token from Azure Ad
- Generate user delegation key using oAuth Token
- Generate SAS Token using user delegation key
I am able to find the Rest service for step 1 & 2, I don't find any Rest service for step 3.
Is any Rest service is available to get the SAS Token using user delegation key
Thanks in Advance.
I am able to generate the delegation key and now I want to get SAS Token by using this user delegation key.
Note :- I have to use only Rest service for it
ANSWER
Answered 2022-Mar-22 at 13:45AFAIK, there is no REST API to create a User Delegation SAS Token/URL.
Once you get the User Delegation Key which should contain the parameters needed to create User Delegation SAS, you will need to follow the instructions specified here: https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas#construct-a-user-delegation-sas.
UPDATE:
For signing purpose, you would need to use the Value
returned when you acquired the User Delegation Key.
This is what the response should be for getting the User Delegation Key:
String containing a GUID value
String containing a GUID value
String formatted as ISO date
String formatted as ISO date
b
String specifying REST api version to use to create the user delegation key
String containing the user delegation key
You would use the attribute's value. Please see the code
here
. This is how .Net SDK calculates the signature.
QUESTION
I want to add to the user all possible group memberships in the Azure Active Directory, but there are so many groups so I dont want to do it manually, is there any script or button to do this quickly?
ANSWER
Answered 2022-Mar-21 at 15:52try this in powershell install azure AD module
PS C:\Windows\system32> install-module azuread
PS C:\Windows\system32> import-module azuread
you can verify it by :
PS C:\Windows\system32> get-module azuread
Now connect your powershell to the directory
PS C:\Windows\system32> Connect-AzureAD
it will prompts you for the credentials you want to use to access your directory and returns a confirmation to show the session was connected successfully to your directory:
Account Environment Tenant ID
------- ----------- ---------
xxx@xxxx.onmicrosoft.com AzureCloud 23b5ff1e-3402-800c-823c-3f…
To retrieve existing groups from your directory, use the Get-AzureADGroups cmdlet
$groups= get-azureadgroup
foreach ($group in $groups)
{
Add-AzureADGroupMember -ObjectId $group.ObjectId -RefObjectId
}
replace the user reference id, you can use Get-AzureADUser to get that
QUESTION
I'm new to Azure and trying to set up my nextjs client app and my ASP.NET Core backend app. Everything seems to play well now, except for file uploads. It's working on localhost, but in production the backend returns a 404 web page (attached image) before reaching the actual API endpoint. I've also successfully tested to make a multipart/form-data POST request in Postman from my computer.
The way I implemented this is that I'm proxying the upload from the browser through an api route (client's server side) to the backend. I have to go via the client server side to append a Bearer token from a httpOnly cookie.
I've enabled CORS in Startup.cs:
app.UseCors(builder => { builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod(); });
The frontend and backend apps are running in individual services and I've tried to enable CORS in the Azure portal as well, but there I could only allow origins, not headers and methods? The error message doesn't indicate CORS problems, but I just wanted make sure..
As far as I can see the requests look good, with correct URLs and origins. I suspect I'm missing some config in azure, but I didn't get any further by following the hints in the error message.
Any suggestions to what may cause this? Or where I can start looking. I'm not quite sure where to look for log output for this issue.
ANSWER
Answered 2022-Mar-10 at 06:35Cross-Origin Resource Sharing (CORS) allows JavaScript code running in a browser on an external host to interact with your backend.
To allow all, use "*" and remove all other origins from the list.
I could only allow origins, not headers and methods?
Add the below configuration in your web.config
file to allow headers and methods.
Add the below snippet in web.config=> =>handlers tag
- Make sure the routing is done properly
[Route("api/[controller]")] should be in your controller class.
client cache is still pointing to the domain to ols ip address. clear the cache by running the command ipconfig/flushdns
Please refer Custom domain has not been configured inside Azure ,Azure WebApps Custom Domain 404 error - Flush DNS and SO Thread for more information
QUESTION
I want to find the index number of all items in a nested array in Cosmos DB :
Data :
{
"id":"MyId",
"items" : [
{"id": "Item1"},
{"id" : "Item2"}
]
}
Query :
SELECT f.id, index : ** How to get the index of items ? **
FROM root JOIN f IN root["items"]
WHERE (IS_DEFINED(root["items"]) AND (root["id"] = "MyId"))
I would like a result like this :
[
{"id": "item1", "index": 0},
{"id": "item2", "index" : 1}
]
Thx
ANSWER
Answered 2022-Mar-09 at 04:25There is no built in support on Cosmos SQL API to achieve the above result. But you can implement the following suggestions
You could either write your own logic in User Defined Function or retrieve the data and format it in the way you need on the Client Side
Other way is to just include the index in the data model itself
QUESTION
Hi i am trying to get code coverage with .net5 in azure pipeline.
Run tests (not entire file)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: /home/vsts/work/_temp/_fv-az43-964_2021-08-25_08_31_59.trx
Attachments:
/home/vsts/work/_temp/f5dd5e9f-e260-437d-80ef-4fb917215b09/coverage.cobertura.xml
Passed! - Failed: 0, Passed: 16, Skipped: 0, Total: 16, Duration: 732 ms - /home/vsts/work/1/s/sda2021_webapi/Test/sda2021_api.tests/bin/Release/net5.0/sda2021_webapi.tests.dll (net5.0)
Result Attachments will be stored in LogStore
Run Attachments will be stored in LogStore
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
Async Command Start: Publish test results
Publishing test results to test run '5152'.
TestResults To Publish 16, Test run id:5152
Test results publishing 16, remaining: 0. Test run id: 5152
Published Test Run : https://dev.azure.com/sda-shs/Bratislava2021/_TestManagement/Runs?runId=5152&_a=runCharts
Async Command End: Publish test results
Finishing: Dotnet run tests
Publish tests(not entire file)
##[warning]Multiple file or directory matches were found. Using the first match: /home/vsts/work/_temp/_fv-az43-964_2021-08-25_08_31_59/In/fv-az43-964/coverage.cobertura.xml
/opt/hostedtoolcache/dotnet/dotnet /home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.189.0/netcoreapp2.0/ReportGenerator.dll -reports:/home/vsts/work/_temp/**/coverage.cobertura.xml -targetdir:/home/vsts/work/_temp/cchtml -reporttypes:HtmlInline_AzurePipelines
2021-08-25T08:32:03: Arguments
2021-08-25T08:32:03: -reports:/home/vsts/work/_temp/**/coverage.cobertura.xml
And of course my pipeline
task: DotNetCoreCLI@2
displayName: Dotnet run tests
inputs:
command: "test"
projects: "**/xxxxx/*.tests.csproj"
arguments: '--configuration Release /p:CoverletOutputFormat=cobertura --collect:"XPlat Code Coverage" --no-build'
testRunTitle: "xxxx"
- task: PublishCodeCoverageResults@1
displayName: "publish coverage results"
inputs:
codeCoverageTool: "Cobertura"
summaryFileLocation: "$(Agent.TempDirectory)/**/coverage.cobertura.xml"
Why is more then one XML generated? I am basically balancing between no XML and more XML. I am just unable to generate one XML. (on my localhost it generates only one) Thanks for any tips.
ANSWER
Answered 2021-Aug-25 at 08:52Please replace your PublishCodeCoverageResults
with following steps:
- task: reportgenerator@4
displayName: 'Merge code coverage reports'
inputs:
reports: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
targetdir: '$(Pipeline.Workspace)/coverlet'
reporttypes: 'Cobertura'
verbosity: 'Verbose'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage results'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Pipeline.Workspace)/coverlet/Cobertura.xml'
And you have multiple files, because probably you have more than one test project.
QUESTION
I’ve the following yaml which I need to apply using the K8S go sdk (and not k8s cli) I didn’t find a way with the go sdk as it is custom resource, any idea how I can apply it via code to k8s?
This is the file
Any example will be very helpful!
apiVersion: aps.dp.com/v1alpha1
kind: Edtack
metadata:
name: ed01
namespace: ctr
spec:
intRef:
name: evr
stack:
- name: vectnt
namespace: aps
path: https://packages.timber.io/helm/latest/vect-0.11.0.tgz
valuesRef:
name: vecvalues
- name: ek
namespace: lg
path: rescharts/bing
- name: apigw-gloo-ee
namespace: apw
path: https://common.cdn.repositories.cloud.sap/api-gateway/apigw-gloo-ee/apigw-gloo-ee-0.3.0.tgz
pullSecretRef:
name: svr-secret
valuesSecretRef:
name: apis
- name: kuback
namespace: kube-prom
path: https://github.com/prometheus-community/helm-charts/releases/download/kube-prometheus-stack-16.12.0/kube-prometheus-stack-16.12.0.tgz
valuesSecretRef:
name: kubes
ANSWER
Answered 2022-Jan-17 at 16:00package main
import (
"context"
"flag"
"log"
"path/filepath"
"github.com/pytimer/k8sutil/apply"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
)
const applyStr = `
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
ports:
- name: web
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: ClusterIP
`
func main() {
var kubeconfig *string
if home := homedir.HomeDir(); home != "" {
kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
} else {
kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
}
flag.Parse()
// use the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
if err != nil {
panic(err.Error())
}
dynamicClient, err := dynamic.NewForConfig(config)
if err != nil {
panic(err.Error())
}
discoveryClient, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
panic(err.Error())
}
applyOptions := apply.NewApplyOptions(dynamicClient, discoveryClient)
if err := applyOptions.Apply(context.TODO(), []byte(applyStr)); err != nil {
log.Fatalf("apply error: %v", err)
}
}
QUESTION
I updated my Asp.net core Blazor WebAssembly app to .net 6. Everything is fine, but the deploy from github actions doesn't work and throws this error:
...
Copying file: 'Microsoft.AspNetCore.ApiAuthorization.IdentityServer.dll'
Copying file: 'Microsoft.AspNetCore.Authentication.JwtBearer.dll'
Omitting next output lines...
Error: EISDIR: illegal operation on a directory, open '/home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE'
An error has occurred during web site deployment.
Kudu Sync failed
\n/opt/Kudu/Scripts/starter.sh "/home/site/deployments/tools/deploy.sh"
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
What could be a problem here?
- app works on local
- I updated the azure app to .net6 in configuration
- I tried to restart the app
- the app is in Central US region
EDIT/SOLUTION:
Previously the path to licence file was: /home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE/LICENSE
new file was without the LICENSE
dir. So when the new version of app arrived it tried to update the LICENSE file, which was actually a directory. Removing LICENSE/LICENSE
helped.
ANSWER
Answered 2021-Nov-15 at 05:26On Linux, it's important that any bash deployment scripts that get run have Unix line endings (LF) and not Windows line endings (CRLF).
Kuduscript will generate scripts with platform-appropriate line endings, but if those scripts are modified, or if you provide your own custom deployment scripts, it's important to make sure that your editor doesn't change the line endings.
If something seems off with your deployment script, you can always use the Kudu console to delete the contents of /home/site/deployments/tools.
This is the directory where Kudu caches kuduscript-generated deployment scripts. On the next deployment, the script will be regenerated.
The error you're currently seeing is a Kudu issue with running node/npm for deployments.
The easiest and fastest resolution for what you are currently seeing is to specify engines.node in your package.json.
Error: EISDIR: illegal operation on a directory, open '/home/site/wwwroot/wwwroot/Identity/lib/bootstrap/LICENSE'
EISDIR stands for "Error, Is Directory". This means that NPM is trying to do something to a file but it is a directory. In your case, NPM is trying to "read" a file which is a directory. Since the operation cannot be done the error is thrown.
Three things to make sure here
- Make sure the file exists. If it does not, you need to create it. (If NPM depends on any specific information in the file, you will need to have that information there).
- Make sure it is in fact a file and not a directory.
- It has the right permissions. You can change the file to have all permissions with "sudo chmod 777 FILE_NAME".
Note: You are giving Read, Write and Execute permissions to every one on that file.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Serverless-microservices-reference-architecture
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page