GET https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/userProvidedFunctionApps?api-version=2024-11-01
/**
* Samples for StaticSites GetUserProvidedFunctionAppsForStaticSite.
*/
public final class Main {
/*
* x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2024-11-01/examples/
* GetUserProvidedFunctionAppsForStaticSite.json
*/
/**
* Sample code: Get details of the user provided function apps registered with a static site.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getDetailsOfTheUserProvidedFunctionAppsRegisteredWithAStaticSite(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.webApps().manager().serviceClient().getStaticSites().getUserProvidedFunctionAppsForStaticSite("rg",
"testStaticSite0", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.web import WebSiteManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-web
# USAGE
python get_user_provided_function_apps_for_static_site.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WebSiteManagementClient(
credential=DefaultAzureCredential(),
subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
)
response = client.static_sites.get_user_provided_function_apps_for_static_site(
resource_group_name="rg",
name="testStaticSite0",
)
for item in response:
print(item)
# x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2024-11-01/examples/GetUserProvidedFunctionAppsForStaticSite.json
if __name__ == "__main__":
main()
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/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/web/resource-manager/Microsoft.Web/stable/2024-11-01/examples/GetUserProvidedFunctionAppsForStaticSite.json
func ExampleStaticSitesClient_NewGetUserProvidedFunctionAppsForStaticSitePager() {
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)
}
pager := clientFactory.NewStaticSitesClient().NewGetUserProvidedFunctionAppsForStaticSitePager("rg", "testStaticSite0", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.StaticSiteUserProvidedFunctionAppsCollection = armappservice.StaticSiteUserProvidedFunctionAppsCollection{
// Value: []*armappservice.StaticSiteUserProvidedFunctionAppARMResource{
// {
// Name: to.Ptr("testFunctionApp"),
// Type: to.Ptr("Microsoft.Web/staticSites/builds/userProvidedFunctionApps"),
// ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/builds/default/userProvidedFunctionApps/testFunctionApp"),
// Properties: &armappservice.StaticSiteUserProvidedFunctionAppARMResourceProperties{
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:33:11.641Z"); return t}()),
// FunctionAppRegion: to.Ptr("West US 2"),
// FunctionAppResourceID: to.Ptr("/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/functionRG/providers/Microsoft.Web/sites/testFunctionApp"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WebSiteManagementClient } = require("@azure/arm-appservice");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Description for Gets the details of the user provided function apps registered with a static site
*
* @summary Description for Gets the details of the user provided function apps registered with a static site
* x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2024-11-01/examples/GetUserProvidedFunctionAppsForStaticSite.json
*/
async function getDetailsOfTheUserProvidedFunctionAppsRegisteredWithAStaticSite() {
const subscriptionId =
process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "rg";
const name = "testStaticSite0";
const credential = new DefaultAzureCredential();
const client = new WebSiteManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.staticSites.listUserProvidedFunctionAppsForStaticSite(
resourceGroupName,
name,
)) {
resArray.push(item);
}
console.log(resArray);
}
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.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.AppService;
// Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-11-01/examples/GetUserProvidedFunctionAppsForStaticSite.json
// this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppsForStaticSite" 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 StaticSiteResource created on azure
// for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource
string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
string resourceGroupName = "rg";
string name = "testStaticSite0";
ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId);
// get the collection of this StaticSiteUserProvidedFunctionAppResource
StaticSiteUserProvidedFunctionAppCollection collection = staticSite.GetStaticSiteUserProvidedFunctionApps();
// invoke the operation and iterate over the result
await foreach (StaticSiteUserProvidedFunctionAppResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
StaticSiteUserProvidedFunctionAppData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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