microsoft / Microsoft-Fabric-workload-development-sample

Demonstrates how to implement a Microsoft Fabric workload in .net and typescript
Other
30 stars 16 forks source link

use Azure CLI's @<file> convention to call az rest #70

Closed LeonardHd closed 2 months ago

LeonardHd commented 3 months ago

Fixes #69 and #67

To validate I suggest using the following .devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
    "name": "Default Linux Universal",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/universal:2-linux",

    // Features to add to the dev container. More info: https://containers.dev/features.
    "features": {
        "ghcr.io/devcontainers/features/powershell:1" : {},
        "ghcr.io/devcontainers/features/azure-cli:1" : {}
    }

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],

    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "uname -a",

    // Configure tool-specific properties.
    // "customizations": {},

    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    // "remoteUser": "root"
}
LeonardHd commented 2 months ago

Ran the script on Ubuntu 22.04 with the following output:

PS /home/leonard/Microsoft-Fabric-workload-development-sample/Authentication> cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
PS /home/leonard/Microsoft-Fabric-workload-development-sample/Authentication> pwsh --version
PowerShell 7.4.5
PS /home/leonard/Microsoft-Fabric-workload-development-sample/Authentication> az --version
azure-cli                         2.63.0

core                              2.63.0
telemetry                          1.1.0

Dependencies:
msal                              1.30.0
azure-mgmt-resource               23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/home/leonard/.azure/cliextensions'

Python (Linux) 3.11.8 (main, Jul 31 2024, 03:39:39) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.
PS /home/leonard/Microsoft-Fabric-workload-development-sample/Authentication> git branch
  main
  patch-1
* use-az-cli-@-file-convention
PS /home/leonard/Microsoft-Fabric-workload-development-sample/Authentication> ./CreateDevAADApp.ps1 "AtFileNotation" "Org.AtFile" "<REDACTED>"
WARNING: A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
------------------------------------------------
------------------------------------------------
------------------------------------------------
All set! Here's what you need:
------------------------------------------------
ApplicationIdUri / Audience : api://localdevinstance/<REDACTED>/Org.AtFile/bVA
RedirectURI : http://localhost:60006/close
Application Id : <REDACTED>
secret : <REDACTED>
------------------------------------------------
You can see the application here: https://ms.portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/~/Overview/appId/<REDACTED>/isMSAApp~/false
------------------------------------------------
You can consent for the application for your tenant (Valid from tenant admin only) here, wait a minute before navigating: https://login.microsoftonline.com/<REDACTED>/adminconsent?client_id=<REDACTED>