POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/testsite2/deployWorkflowArtifacts?api-version=2024-04-01
{
"files": {
"test1/workflow.json": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"When_events_are_available_in_Event_hub": {
"inputs": {
"parameters": {
"eventHubName": "test123"
},
"serviceProviderConfiguration": {
"connectionName": "eventHub",
"operationId": "receiveEvents",
"serviceProviderId": "/serviceProviders/eventHub"
}
},
"splitOn": "@triggerOutputs()?['body']",
"type": "ServiceProvider"
}
}
},
"kind": "Stateful"
},
"connections.json": {
"serviceProviderConnections": {
"eventHub": {
"parameterValues": {
"connectionString": "@appsetting('eventHub_connectionString')"
},
"serviceProvider": {
"id": "/serviceProviders/eventHub"
},
"displayName": "example1"
}
},
"managedApiConnections": {}
}
},
"appSettings": {
"eventHub_connectionString": "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE="
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.appservice.models.WorkflowArtifacts;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for WebApps DeployWorkflowArtifacts.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PostDeployWorkflowArtifacts.json
*/
/**
* Sample code: Deploys workflow artifacts.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void deploysWorkflowArtifacts(com.azure.resourcemanager.AzureResourceManager azure)
throws IOException {
azure.webApps().manager().serviceClient().getWebApps()
.deployWorkflowArtifactsWithResponse("testrg123", "testsite2", new WorkflowArtifacts()
.withAppSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"eventHub_connectionString\":\"Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE=\"}",
Object.class, SerializerEncoding.JSON))
.withFiles(mapOf("connections.json",
SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"managedApiConnections\":{},\"serviceProviderConnections\":{\"eventHub\":{\"displayName\":\"example1\",\"parameterValues\":{\"connectionString\":\"@appsetting('eventHub_connectionString')\"},\"serviceProvider\":{\"id\":\"/serviceProviders/eventHub\"}}}}",
Object.class, SerializerEncoding.JSON),
"test1/workflow.json",
SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"definition\":{\"$schema\":\"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#\",\"actions\":{},\"contentVersion\":\"1.0.0.0\",\"outputs\":{},\"triggers\":{\"When_events_are_available_in_Event_hub\":{\"type\":\"ServiceProvider\",\"inputs\":{\"parameters\":{\"eventHubName\":\"test123\"},\"serviceProviderConfiguration\":{\"operationId\":\"receiveEvents\",\"connectionName\":\"eventHub\",\"serviceProviderId\":\"/serviceProviders/eventHub\"}},\"splitOn\":\"@triggerOutputs()?['body']\"}}},\"kind\":\"Stateful\"}",
Object.class, SerializerEncoding.JSON))),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armappservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v4"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b5d78da207e9c5d8f82e95224039867271f47cdf/specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PostDeployWorkflowArtifacts.json
func ExampleWebAppsClient_DeployWorkflowArtifacts_deploysWorkflowArtifacts() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armappservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewWebAppsClient().DeployWorkflowArtifacts(ctx, "testrg123", "testsite2", &armappservice.WebAppsClientDeployWorkflowArtifactsOptions{WorkflowArtifacts: &armappservice.WorkflowArtifacts{
AppSettings: map[string]any{
"eventHub_connectionString": "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE=",
},
Files: map[string]any{
"connections.json": map[string]any{
"managedApiConnections": map[string]any{},
"serviceProviderConnections": map[string]any{
"eventHub": map[string]any{
"displayName": "example1",
"parameterValues": map[string]any{
"connectionString": "@appsetting('eventHub_connectionString')",
},
"serviceProvider": map[string]any{
"id": "/serviceProviders/eventHub",
},
},
},
},
"test1/workflow.json": map[string]any{
"definition": map[string]any{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": map[string]any{},
"contentVersion": "1.0.0.0",
"outputs": map[string]any{},
"triggers": map[string]any{
"When_events_are_available_in_Event_hub": map[string]any{
"type": "ServiceProvider",
"inputs": map[string]any{
"parameters": map[string]any{
"eventHubName": "test123",
},
"serviceProviderConfiguration": map[string]any{
"operationId": "receiveEvents",
"connectionName": "eventHub",
"serviceProviderId": "/serviceProviders/eventHub",
},
},
"splitOn": "@triggerOutputs()?['body']",
},
},
},
"kind": "Stateful",
},
},
},
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.AppService.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.AppService;
// Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PostDeployWorkflowArtifacts.json
// this example is just showing the usage of "WebApps_DeployWorkflowArtifacts" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this WebSiteResource created on azure
// for more information of creating WebSiteResource, please refer to the document of WebSiteResource
string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
string resourceGroupName = "testrg123";
string name = "testsite2";
ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId);
// invoke the operation
WorkflowArtifacts workflowArtifacts = new WorkflowArtifacts()
{
AppSettings = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["eventHub_connectionString"] = "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE="
}),
Files =
{
["connections.json"] = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["managedApiConnections"] = new Dictionary<string, object>()
{
},
["serviceProviderConnections"] = new Dictionary<string, object>()
{
["eventHub"] = new Dictionary<string, object>()
{
["displayName"] = "example1",
["parameterValues"] = new Dictionary<string, object>()
{
["connectionString"] = "@appsetting('eventHub_connectionString')"},
["serviceProvider"] = new Dictionary<string, object>()
{
["id"] = "/serviceProviders/eventHub"}}}}),
["test1/workflow.json"] = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["definition"] = new Dictionary<string, object>()
{
["$schema"] = "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
["actions"] = new Dictionary<string, object>()
{
},
["contentVersion"] = "1.0.0.0",
["outputs"] = new Dictionary<string, object>()
{
},
["triggers"] = new Dictionary<string, object>()
{
["When_events_are_available_in_Event_hub"] = new Dictionary<string, object>()
{
["type"] = "ServiceProvider",
["inputs"] = new Dictionary<string, object>()
{
["parameters"] = new Dictionary<string, object>()
{
["eventHubName"] = "test123"},
["serviceProviderConfiguration"] = new Dictionary<string, object>()
{
["operationId"] = "receiveEvents",
["connectionName"] = "eventHub",
["serviceProviderId"] = "/serviceProviders/eventHub"}},
["splitOn"] = "@triggerOutputs()?['body']"}}},
["kind"] = "Stateful"}),
},
};
await webSite.DeployWorkflowArtifactsAsync(workflowArtifacts: workflowArtifacts);
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue