diff --git a/.changeset/migrate-1713465887317.md b/.changeset/migrate-1713465887317.md new file mode 100644 index 0000000000..0d70481132 --- /dev/null +++ b/.changeset/migrate-1713465887317.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-azure-sites': patch +'@backstage/plugin-azure-sites-backend': patch +'@backstage/plugin-azure-sites-common': patch +--- + +These packages have been migrated to the [backstage/community-plugins](https://github.com/backstage/community-plugins) repository. diff --git a/plugins/azure-sites-backend/README.md b/plugins/azure-sites-backend/README.md index 18c51239c3..c88160dfbf 100644 --- a/plugins/azure-sites-backend/README.md +++ b/plugins/azure-sites-backend/README.md @@ -1,137 +1,3 @@ -# Azure Sites Backend +# Deprecated -Simple plugin that proxies requests to the Azure Portal API through Azure SDK JavaScript libraries. - -_Inspired by [roadie.io AWS Lambda plugin](https://roadie.io/backstage/plugins/aws-lambda/)_ - -## Setup - -The following sections will help you get the Azure Sites Backend plugin setup and running. - -### Configuration - -The Azure plugin requires the following YAML to be added to your app-config.yaml: - -```yaml -azureSites: - domain: - tenantId: - clientId: - clientSecret: - allowedSubscriptions: - - id: -``` - -Configuration Details: - -- `domain` can be found by visiting the [Directories + Subscriptions settings page](https://portal.azure.com/#settings/directory). Alternatively you can inspect the [Azure home](https://portal.azure.com/#home) URL - `https://portal.azure.com/#@/`. -- `tenantId` can be found by visiting [Azure Directory Overview page](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade). -- (Optional) `clientId` and `clientSecret` can be the same values you used for [Azure DevOps Backend](https://github.com/backstage/backstage/tree/master/plugins/azure-devops-backend) or [Azure Integration](https://backstage.io/docs/integrations/azure/org#app-registration) as long as this App Registration has permissions to read your function apps. -- (Optional) `allowedSubscriptions` is an array of `id` that will be used to iterate over and look for the specified functions' app. `id` can be found the [Subscriptions page](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBlade). - -### Integrating - -Here's how to get the backend plugin up and running: - -#### Legacy Backend System - -1. First we need to add the `@backstage/plugin-azure-sites-backend` package to your backend: - - ```sh - # From the Backstage root directory - yarn --cwd packages/backend add @backstage/plugin-azure-sites-backend - ``` - -2. Then we will create a new file named `packages/backend/src/plugins/azure-sites.ts`, and add the following to it: - - ```ts - import { - createRouter, - AzureSitesApi, - } from '@backstage/plugin-azure-sites-backend'; - import { Router } from 'express'; - import { PluginEnvironment } from '../types'; - import { CatalogClient } from '@backstage/catalog-client'; - - export default async function createPlugin( - env: PluginEnvironment, - ): Promise { - const catalogApi = new CatalogClient({ discoveryApi: env.discovery }); - return await createRouter({ - logger: env.logger, - azureSitesApi: AzureSitesApi.fromConfig(env.config), - permissions: env.permissions, - catalogApi, - }); - } - ``` - -3. Next we wire this into the overall backend router, edit `packages/backend/src/index.ts`: - - ```ts - import azureSites from './plugins/azure-sites'; - - // Removed for clarity... - - async function main() { - // ... - // Add this line under the other lines that follow the useHotMemoize pattern - const azureSitesEnv = useHotMemoize(module, () => - createEnv('azure-sites'), - ); - - // ... - // Insert this line under the other lines that add their routers to apiRouter in the same way - apiRouter.use('/azure-sites', await azureSites(azureSitesEnv)); - } - ``` - -4. Enable permissions and that the below is just an example policy that forbids anyone but the owner of the catalog entity to trigger actions towards a site tied to an entity, edit your `packages/backend/src/plugins/permission.ts` - - ```diff - // packages/backend/src/plugins/permission.ts - + import { azureSitesActionPermission } from '@backstage/plugin-azure-sites-common'; - ... - class TestPermissionPolicy implements PermissionPolicy { - - async handle(): Promise { - + async handle(request: PolicyQuery, user?: BackstageIdentityResponse): Promise { - if (isPermission(request.permission, azureSitesActionPermission)) { - return createCatalogConditionalDecision( - request.permission, - catalogConditions.isEntityOwner({ - claims: user?.identity.ownershipEntityRefs ?? [], - }), - ); - } - ... - return { - result: AuthorizeResult.ALLOW, - }; - } - ``` - -#### New Backend System - -The Azure Sites backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up: - -In your `packages/backend/src/index.ts` make the following changes: - -```diff - import { createBackend } from '@backstage/backend-defaults'; - - const backend = createBackend(); - - // ... other feature additions - -+ backend.add(import('@backstage/plugin-azure-sites-backend')); - - // ... - - backend.start(); -``` - -#### Start Backed & Test - -1. Now run `yarn start-backend` from the repo root. - -2. Finally, open `http://localhost:7007/api/azure/health` in a browser, it should return `{"status":"ok"}`. +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-azure-sites-backend` instead. diff --git a/plugins/azure-sites-backend/package.json b/plugins/azure-sites-backend/package.json index ff18587913..75969ebcee 100644 --- a/plugins/azure-sites-backend/package.json +++ b/plugins/azure-sites-backend/package.json @@ -1,35 +1,39 @@ { "name": "@backstage/plugin-azure-sites-backend", "version": "0.3.4", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", + "backstage": { + "role": "backend-plugin", + "moved": "@backstage-community/plugin-azure-sites-backend" + }, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", "types": "dist/index.d.ts" }, - "backstage": { - "role": "backend-plugin" - }, + "keywords": [ + "backstage", + "azure" + ], "homepage": "https://backstage.io", "repository": { "type": "git", "url": "https://github.com/backstage/backstage", "directory": "plugins/azure-sites-backend" }, - "keywords": [ - "backstage", - "azure" + "license": "Apache-2.0", + "main": "src/index.ts", + "types": "src/index.ts", + "files": [ + "dist" ], "scripts": { - "start": "backstage-cli package start", "build": "backstage-cli package build", - "lint": "backstage-cli package lint", - "test": "backstage-cli package test", "clean": "backstage-cli package clean", + "lint": "backstage-cli package lint", "prepack": "backstage-cli package prepack", - "postpack": "backstage-cli package postpack" + "postpack": "backstage-cli package postpack", + "start": "backstage-cli package start", + "test": "backstage-cli package test" }, "dependencies": { "@azure/arm-appservice": "^14.0.0", @@ -53,7 +57,5 @@ "@backstage/cli": "workspace:^", "@types/supertest": "^2.0.8" }, - "files": [ - "dist" - ] + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-azure-sites-backend instead." } diff --git a/plugins/azure-sites-common/README.md b/plugins/azure-sites-common/README.md new file mode 100644 index 0000000000..f219e21f5e --- /dev/null +++ b/plugins/azure-sites-common/README.md @@ -0,0 +1,3 @@ +# Deprecated + +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-azure-sites-common` instead. diff --git a/plugins/azure-sites-common/package.json b/plugins/azure-sites-common/package.json index a5f5f16dbe..49bc8d7bf9 100644 --- a/plugins/azure-sites-common/package.json +++ b/plugins/azure-sites-common/package.json @@ -3,7 +3,8 @@ "version": "0.1.3", "description": "Common functionalities for the azure plugin", "backstage": { - "role": "common-library" + "role": "common-library", + "moved": "@backstage-community/plugin-azure-sites-common" }, "publishConfig": { "access": "public", @@ -42,5 +43,6 @@ }, "devDependencies": { "@backstage/cli": "workspace:^" - } + }, + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-azure-sites-common instead." } diff --git a/plugins/azure-sites/README.md b/plugins/azure-sites/README.md index 80f923a897..2a62384104 100644 --- a/plugins/azure-sites/README.md +++ b/plugins/azure-sites/README.md @@ -1,73 +1,3 @@ -# Azure Sites Plugin +# Deprecated -Azure Sites (Apps & Functions) plugin support for a given entity. View the current status of the site, quickly jump to site's Overview page, or Log Stream page. - -![preview of Azure table](docs/functions-table.png) - -_Inspired by [roadie.io AWS Lamda plugin](https://roadie.io/backstage/plugins/aws-lambda/)_ - -## Features - -- Azure overview table - -## Plugin Setup - -The following sections will help you get the Azure plugin setup and running - -### Azure Sites Backend - -You need to set up the [Azure Sites Backend plugin](https://github.com/backstage/backstage/tree/master/plugins/azure-sites-backend) before you move forward with any of these steps if you haven't already. - -### Entity Annotation - -To be able to use the Azure Sites plugin you need to add the following annotation to any entities you want to use it with: - -```yaml -azure.com/microsoft-web-sites: -``` - -`` supports case-insensitive exact / partial value. - -Example of Partial Matching: - -Let's say you have a number of functions apps, spread out over different regions (and possibly different subscriptions), and they follow a naming convention: - -``` -func-testapp-eu -func-testapp-ca -func-testapp-us -``` - -The annotation you will use to have the three functions' app appear in the overview table would look like this: - -```yaml -azure.com/microsoft-web-sites: func-testapp -``` - -### Install the component - -1. Install the plugin - -```sh -# From your Backstage root directory -yarn --cwd packages/app add @backstage/plugin-azure-sites -``` - -2. Add widget component to your Backstage instance: - -```ts -// In packages/app/src/components/catalog/EntityPage.tsx -import { EntityAzureSitesOverviewWidget, isAzureWebSiteNameAvailable } from '@backstage/plugin-azure-sites'; - -... - -const serviceEntityPage = ( - - //... - Boolean(isAzureWebSiteNameAvailable(e))} path="/azure" title="Azure"> - - - //... - -); -``` +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-azure-sites` instead. diff --git a/plugins/azure-sites/package.json b/plugins/azure-sites/package.json index d39e7ea975..b1f57c057d 100644 --- a/plugins/azure-sites/package.json +++ b/plugins/azure-sites/package.json @@ -2,7 +2,8 @@ "name": "@backstage/plugin-azure-sites", "version": "0.1.23", "backstage": { - "role": "frontend-plugin" + "role": "frontend-plugin", + "moved": "@backstage-community/plugin-azure-sites" }, "publishConfig": { "access": "public", @@ -64,5 +65,6 @@ "react": "^16.13.1 || ^17.0.0 || ^18.0.0", "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0", "react-router-dom": "6.0.0-beta.0 || ^6.3.0" - } + }, + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-azure-sites instead." }