Giter Club home page Giter Club logo

ng-deploy-azure's Issues

feature: add deploy npm script to package.json

Description

As part of schematics, it would be nice to also add a "deploy": "ng run <name>:deploy" npm script to follow usual nodejs project conventions.
This is also a good thing to have when you don't have a global ng cli install, as you can directly use the local install this way, not needing to change anything on your env to deploy.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Disable interactive login mode on CI

Describe the bug
When trying to run a continuous deployment process (eg. from GitHub Actions), the interactive login mode blocks the CI.

Additional context (copy of internal discussion)

Wassim Chegham 4 days ago

Last time I investigated this, I hit an issue regarding the login process while trying to deploy from the Github Action. TBH, I was expecting this! So the issue is that we are using an interactive login method interactiveLoginWithAuthResponse on @azure/ng-deploy.

I was thinking we should switch to a loginWithServicePrincipalSecretWithAuthResponsez login method when we are in a CI environment. See https://github.com/Azure/ms-rest-nodeauth#service-principal-and-secret-based-login

Then, in the pipeline or CI config, we should create and use Github secrets like this:

- name: deploy to Azure
      env:
        AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }}
        AZURE_SERVICE_PRINCIPAL_PASSWORD: ${{ secrets.AZURE_SERVICE_PRINCIPAL_PASSWORD }}
        AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
      run: |
        ng run angular-demo-app:deploy --service-principal -u $AZURE_SERVICE_PRINCIPAL -p $AZURE_SERVICE_PRINCIPAL_PASSWORD --tenant $AZURE_TENANT

I had this feature on my todo list for some time now. I'd be happy to send a PR, I just need to find some time to work on it.

Wassim Chegham 4 days ago

I forgot to mention that prior to this, we need to create a SP. We can do it from the CLI:

az ad sp create-for-rbac --name GithubActionDeployToAzure

which will give us the following content

{
  "appId": "aa1307xx-11xx-41xx-8bxx-e4xxbd2xxb52",
  "displayName": "GithubActionDeployToAzure",
  "name": "http://GithubActionDeployToAzure",
  "password": "e0xx8cxx-xxxx-xxxx-xxx-xxbxx56xxcxx",
  "tenant": "72xx88xx-86xx-41xx-91xx-xx7xx0xxdbxx"
}

Demo repo##

See https://github.com/manekinekko/github-action-deploy-to-azure/blob/c7ec9ec03919554c24b221bfc560dd5221927fa8/.github/workflows/nodejs.yml#L1-L34

Support managed identity login

Describe the bug
This is more of a feature request than a bug.

It's not possible to use Azure's managed identity feature for login (MSI). I noticed that the library used for authentication, @azure/ms-rest-nodeauth actually supports MSI login, but this lib does not make use of it. I tried to modify the source of ng-deploy-azure to call that functionality, but because the dependency uses a very old version of ms-rest-nodeauth, it tries to authenticate to MSI an approach that is now deprecated (uses localhost instead of IMDS -- https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/howto-migrate-vm-extension).

To Reproduce
Steps to reproduce the behavior:

  1. Turn on Managed Identity for a VM
  2. There is no way to tell ng-deploy-azure to use the now-logged-in MSI.

Expected behavior

  1. Turn on Managed Identity for a VM
  2. Have a way to tell ng-deploiy-azure to use MSI credentials (should work even if env var CI=1 is set)
  3. Deployment command should use the MSI identity to access storage and deploy

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
I was mainly looking for this feature because we want to use this package in our CI, but we don't want hardcoded user/passwords (i.e. service principal client ID and secret) written into our code or configs. An alternative would be to use an SP that is backed by a certificate in Azure Keystore but you don't support that either.

Subscription activity is not updated

When you first add deploy with inactive subscription you got
You don't have any active subscriptions. Head to https://azure.com/free and sign in. From there you can create a new subscription and then you can come back and try again.

Then activate account (old one)

After this ng add @azure/ng-deploy just stuck to
You don't have any active subscriptions. Head to https://azure.com/free and sign in. From there you can create a new subscription and then you can come back and try again.

Though subscription already active.

Had to move to firebase (

Process to publish pull requests for feature preview

Description

We would like to publish a feature/preview site to azure storage for each pull request. The process would be

  • Deploy angular to azure blob storage

  • Create comment in Azure Devops / GitHub with preview url

  • Update deployment on new pushes

  • Delete storage account when PR get's merged

  • Maybe this can be a build task for azure devops / github actions?

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Assignee

Projects

I would like to contribute here but I would need some support :)

Look at integrating release-it

Description

This library facilitates versioning and helps to publish to NPM
https://www.npmjs.com/package/release-it

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

Skip build and deploy directly is not working as described

I'd like to avoid building automatically and deploying directly from a path, ideally I'd like to get an error if the path to be deployed is not existing or empty.

So I followed what is described in the README:

Another option is to skip build, and deploy directly from a specific location. To do this, delete the target and configuration from azure.json, and provide a path with a value relative to the root of the project.

Prequisite: I first built with the configuration I need & "ng add ng-deploy-azure" run

If I only add "path", "ng run hello-world:deploy" is deploying without building as expected:

Example azure.json

{
"hosting": [
{
"app": {
"project": "hello-world",
"target": "build",
"configuration": "production"
"path": "public/static/hello-world"
},
"azureHosting": {
...
}
}
]
}

But if I follow exactly what is described, I mean removing target & config, to avoid the automatic build, I got the following error message:

Error when trying to deploy:
Azure hosting config is missing some details. Please run "ng add ng-deploy-azure" and select a storage account.

Example azure.json

{
"hosting": [
{
"app": {
"project": "hello-world",
"path": "public/static/hello-world"
},
"azureHosting": {
...
}
}
]
}

I'd like to know what should I keep and what I can remove from this file to achieve my goal : deploying without building and getting an error if the app has not been built before (path empty or not existing)?
I think that the README should be updated.
Thanks for your help

Update to Angular 8 stable version and update typescript to 3.4.x

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

feature: allow to reconfigure azure params

Description

It would be nice to add a command to re-run the azure.json config process (login/subscription/resource group...) without having to do ng add again or edit the config file manually.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

"Project target does not exist." on any command

Describe the bug
I am using Angular 9 RC0, so this may not be supported (yet), but essentially I can't get any of this plugin to work without the title error message appearing. Even the azureLogout command fails.

To Reproduce
Follow precisely the instructions on the readme for this plugin, but with Angular 9 up to and including step 4: Deploy your project to Azure.

The command fails with the following error:

An unhandled exception occurred: Project target does not exist.

Expected behavior
No error.

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
Add any other context about the problem here.

specified container does not exist.

When I try to deploy I get this message.

I have already created the ressource group name and ressource.

Error when trying to deploy: 
<?xml version="1.0" encoding="utf-8"?><Error><Code>ContainerNotFound</Code><Message>The specified container does not exist.
RequestId:fxxxxxxxxxx23-7770-7e14e5000000
Time:2019-10-09T07:06:04.9834123Z</Message></Error>

Should I create a container ? how should I call it? I don't see any container in azure.json

The Resource was not found.

I get this error when trying to deploy after login to azure on console:
The Resource 'Microsoft.Storage/storageAccounts/appstatic' under resource group 'app-static-deploy' was not found.

here's my azure.json config

{
  "hosting": [
    {
      "app": {
        "project": "app",
        "target": "build",
        "configuration": "production",
        "path": "dist"
      },
      "azureHosting": {
        "subscription": "xxxxxxxx",
        "resourceGroupName": "app-static-deploy",
        "account": "appstatic"
      }
    }
  ]
}```

Unable to deploy: An unhandled exception occurred: Project target does not exist.

Describe the bug
I am trying to deploy a sample angular app as per the instructions given here.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the below steps as in to this tutorial create a new angular app
npm install -g @angular/cli@8                    # Install the Angular CLI
ng new iam-spa --routing=true --style=css # Generate a new Angular app
cd <app-path>                                # Change to the app directory
npm install @angular/material@8 @angular/cdk@8   # Install the Angular Material component library (optional, for UI)
npm install msal @azure/msal-angular             # Install MSAL and MSAL Angular in your application
ng generate component home                  # To add a new page (such as a home or profile page)
  1. Run ng serve to launch the app and see if it is created alright.
  2. Add ng-deploy to your project
    ng add @azure/ng-deploy
  3. Deploy your project to Azure.
    ng run iam-spa:deploy
  4. When I run the above command, I am getting the below error:

An unhandled exception occurred: Project target does not exist.
See "C:\Users\username\AppData\Local\Temp\ng-QzVaez\angular-errors.log" for further details.

I tried the same steps by creating a new service-principal with role contributor and login with it. But, no luck. Please check

My Angular.json has:
{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "iam-spa": { "projectType": "application", "schematics": { "@schematics/angular:application": { "strict": true } }, "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/iam-spa", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "aot": true, "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css" ], "scripts": [] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "namedChunks": false, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "budgets": [ { "type": "initial", "maximumWarning": "500kb", "maximumError": "1mb" }, { "type": "anyComponentStyle", "maximumWarning": "2kb", "maximumError": "4kb" } ] } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "browserTarget": "iam-spa:build" }, "configurations": { "production": { "browserTarget": "iam-spa:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { "browserTarget": "iam-spa:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css" ], "scripts": [] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json" ], "exclude": [ "**/node_modules/**" ] } }, "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", "devServerTarget": "iam-spa:serve" }, "configurations": { "production": { "devServerTarget": "iam-spa:serve:production" } } } } } }, "defaultProject": "iam-spa" }

Expected behavior
The app should be deployed into Azure

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows 10
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22]

Please let me know what I am missing. Thanks much!

NOT SUPPORTED: keyword "id", use "$id" for schema ID

Walking through the Quick Start I get the

NOT SUPPORTED: keyword "id", use "$id" for schema ID error

when I ng add @azure/ng-deploy

To Reproduce
Steps to reproduce the behavior:
Go through the quickstart step by step

Here's my angular/OS version info

Angular CLI: 14.2.1
Node: 16.14.0
Package Manager: npm 8.3.1
OS: win32 x64

Angular:
...

Package Version

@angular-devkit/architect 0.1402.1 (cli-only)
@angular-devkit/core 14.2.1 (cli-only)
@angular-devkit/schematics 14.2.1 (cli-only)
@schematics/angular 14.2.1 (cli-only)

Specified container do not exist when running logic app to copy blobs from one container to other

I am getting this strange issue where on copying blobs from one storage account to other, the content type of blob changes which I believe is failing my logic app.

So in Storage A, I have a blob with content type as application/octet-stream which a .txt file, if I copy this file to my storage account B using storage explorer, the content type changes to text/plain; charset=utf-8

Problem now I am having is with application/octet-stream as I designed my logic app with my storage explorer B and now changing the connection string to Storage Explorer A , my logic app is returning application/octet-stream which i believe is giving me error as specific container not found in logic app Copy Blob activity.

image

So i would like to know why this behavior. Is there some way we can fix the content type of a storage account?

DOC: Move local dev and testing instructions to Contributing.md

Description

add to contribution file

  • npm pack
  • npm install [zip file]

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

DOC: Create description for Release process

Description

this is about creating a doc that shows how we release code and ensure it ends up in NPM

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

Cant install package

Describe the bug
Attempted to install by running
ng add @azure/ng-deploy
Install failed.
First saw error messages that needed python 2.7. Installed that.
Then saw error messages that needed windows SDK 8.1. Installed that.
Now getting error message:
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [D:\my-app\node_modules\get-cursor-position\build\pos.vcxproj]
I give up :(

To Reproduce
ng add @azure/ng-deploy

Expected behavior
package should be added

Desktop:

  • OS: Windows 10

Additional context
Angular cli 8.3.1

E2E test crashes when the path has spaces

Describe the bug
The e2e test crashes because it can't find the dir. This happens when the path includes spaces.
Error: 'Could not install from ".." as it does not contain a package.json file.'

To Reproduce
Steps to reproduce the behavior:

  1. Create a directory which has a space in its name, i.e. my projects
  2. Clone this project into this directory
  3. Run npm i
  4. Run npm run test:e2e

Expected behavior
The tests should run on the project wherever it is (path with spaces).

Access storage account using connection string

Description

It would be nice if we had the option to connect to an existing storage account using a connection string. Sometimes, front end developers do not have direct access to the Azure subscription (e.g. the subscription is managed from another person's email in the organization) and are not able to specify it during the ng-deploy configuration process. Instead, the person that has the subscription under control (e.g. the backend developer or the devops engineer) issues a Shared Access Signature connection string and provides it in order to connect to the storage account.

Type of change

  • New feature (non-breaking change which adds functionality)

image

Deploy command should either build or not build consistently

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

ng new hello-world --defaults
cd hello-world
ng add @azure/ng-deploy
ng run hello-world:deploy

The app builds and then deploys.

Now change something in the app. Then run ...

ng run hello-world:deploy

Browser to the site in Azure. Notice that what is deployed does not contain your changes. It appears that the deploy command is not building if something already exists in the dist/ folder.

Expected behavior
I expected that the deploy command would have always re-built the angular app first or never rebuild it. Options:

  1. always rebuild before deploying ng build --prod
  2. never rebuild before deploying. but this would cause an error or the results i mention above.
  3. prompt the user to rebuild

I like 1 or 3.

Thoughts?

ng deploy fails when using an existing resource group and storage account during ng add

Describe the bug
When invoking ng add using an existing resource group and storage account, ng deploy will fail with the following error:

Error when trying to deploy: 
<?xml version="1.0" encoding="utf-8"?><Error><Code>ContainerNotFound</Code><Message>The specified container does not exist.
RequestId:0a02c7fb-101e-0133-3bf5-7229ae000000
Time:2019-09-24T16:33:50.0066513Z</Message></Error>

To Reproduce
Steps to reproduce the behavior:

  1. ng add @azure/ng-deploy --resourceGroup existing-rg--account existingstorage
  2. ng deploy

Fix @types/ascii-progress typings issue

We currently set noImplicitAny to false. This may not be ideal. Another option is to fix the typings below locally. Or to fix them in the library's github repo with a PR.

Putting this here so we do not forget

> [email protected] build /Users/papa/_git/ng-deploy-azure
> tsc -p tsconfig.json

src/builders/actions/deploy.ts:19:30 - error TS7016: Could not find a declaration file for module 'ascii-progress'. '/Users/papa/_git/ng-deploy-azure/node_modules/ascii-progress/index.js' implicitly has an 'any' type.
  Try `npm install @types/ascii-progress` if it exists or add a new declaration (.d.ts) file containing `declare module 'ascii-progress';`

ng deploy

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @azure/[email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@azure/ng-deploy/out/ng-add/schema.json b/node_modules/@azure/ng-deploy/out/ng-add/schema.json
index 8d84a0a..086381c 100644
--- a/node_modules/@azure/ng-deploy/out/ng-add/schema.json
+++ b/node_modules/@azure/ng-deploy/out/ng-add/schema.json
@@ -1,6 +1,6 @@
 {
   "$schema": "http://json-schema.org/schema",
-  "id": "azure-deploy-schematic-ng-add",
+  "$id": "azure-deploy-schematic-ng-add",
   "title": "Azure Deploy ng-add schematic",
   "type": "object",
   "properties": {

This issue body was partially generated by patch-package.

Folders and their content are not deployed

Describe the bug
On the deploy command, only files that exist in dist// are uploaded to Azure, and not folders. This bug specifically affects the assets folder, which is added to the dist folder on build.

To Reproduce
Steps to reproduce the behavior:

  1. Create files in the project's assets folder
  2. Run ng add @azure/ng-deploy
  3. If the project was build already, build it again: ng build --prod
  4. Run ng run <project-name>:deploy
  5. Go to Azure portal, look at the content of the storage account, under $web.
  6. Optional: If there are references in the project to the files, the resources will be broken on the deployed site. For example, when using <img src="assets/pic.jpg"> in one of the components, the image will be broken on the deployed site.

Expected behavior
The assets folder and its content should exist in the file list in $web.
Images and other assets should be available on the deployed website.

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context

Support for Azure Environments (Sovereign Clouds, like Azure Government)

Right now, the ng-deploy-azure system doesn't support specifying alternative Azure Environments (such as sovereign clouds, like AzureUSGovernment or AzureGermanCloud)

Please add configuration in azure.json to support specifying other clouds. This also implies that authentication can be done against other clouds, and the Azure Storage URL suffixes can be modified to support other clouds.

Allow multiple deploys from same project

Description

The hosting property in azure.json is already designed as an enumerable data structure, however only a single configuration can currently be deployed at a time. I.e if I have multiple configs defined in azure.json, only the first has any impact.

Value:
Deploy same project with various build-configurations

Solution:
Change getAzureHostingConfig to return an array of hosting configs rather than finding the first match. Then run deploy on each configuration.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Fails to find subscription

Describe the bug
Azure ng-deploy fails to find my Visual Studio Enterprise Azure subscription (that I have been using for some time and have many things deployed to)
Ran ng add @azure/ng-deploy
Got expected
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate.
Clicked the link, entered the code. Browser claimed success. Closed browser, saw following message:
You don't have any active subscriptions. Head to https://azure.com/free and sign in. From there you can create a new subscription and then you can come back and try again.

Running it again it doesn't even bother trying to connect, just shows no subscription message immediately. Trying -m flag and passing various params didnt help either.

In contrast the VS Code extension for Azure Storage recommended by the readme has no problem. I am able to see and browse my storage containers.

Expected behavior
Should be able to find my subscription and allow me to deploy.

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
Angular cli 8.3.2

Use SDK for E2E tests

Describe the bug
When running the e2e test, the script uses az - the Azure CLI to clean up the resources. However, we can't expect all developers of ng deploy to have the Azure CLI installed. The cleanup should be done using the resources that are already available - the SDKs that are used in the project.

Error: ./scripts/test.sh: line 44: az.cmd: command not found
To Reproduce
Steps to reproduce the behavior:

  1. If you have Azure CLI, uninstall it. (Run az to see that it's not available)
  2. Run npm run test:e2e
  3. If the tests run as expected, after getting the link of the website, it crashes with the error message above.
  4. Click on the link - it opens the website. Meaning the resources were not cleared.

Expected behavior
3 - the test script should not crash.
4 - the link should not be available.

feature: optionally configure azure CDN

Description

Currently files are deployed on blob storage directly, making a default Angular website generated by ng CLI available, but with some limitations:

  • Redirection to index.html file is working through a workaround: 404 errors redirects to root document, but ideally this should be done using some URL rewriting rules
  • HTTPS cannot be enforced
  • HTTPS cannot be used with custom domains
  • No automatic compression support

All these points could be addressed by configuring Azure CDN on top of the static website.
Though as this incurs additional charges for the deployed website, maybe we would like to make this extra layer optional, prompting the user during initial setup?

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Account name invalid error, if project name is part uppercase or longer than 18 characters

Describe the bug
if you scaffold an Angular project with uppercase characters in it it will error out. Example ExampleApp will not work. The reason is the part of the project name is used to generate an account name.
You get an error looking something like this: {"error":{"code":"AccountNameInvalid","message":"ExampleAppstatic is not a valid storage account name. Storage account name must be between 3 and 24 characters in length and use numbers and lower-case letters only."}}', headers: HttpHeaders { _headersMap: [Object] }

Fix: ensure project name is lowercased before being used as part of account name. Also ensure project name is capped if needed as it must not be longer than 24 characters (Project name + static).

Expected behavior
should be able to handle upper as well as lower case project names and if the project name is longer than 18 characters we need to cap it (project name - static)

Storage Account Name Conflict

Describe the bug
ng add @azure/ng-deploy automatically chooses a storage account name based on the project name when the user initializes it and signs in. Sometimes, that storage account name can conflict with an existing storage account (the name must be globally unique).

Initialization does not immediately make the user aware that they do not own the storage account in question, and the init fails silently. The user is told:

Account {{StorageAccountName}} already exist on subscription, using existing account.

In my case, the storage account name in question was not mine (and not in any of my subscriptions). I am working from an existing code sample.

When the user attempts to deploy the application (ng deploy), the following error is displayed:

The resource 'Microsoft.Storage/storageAccounts/{{StorageAccountName}}' under resource group '{{ResourceGroup}}' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

To Reproduce

Steps to reproduce the behavior:

  1. Choose a project name that causes a conflict with an existing storage account name. For example, name your project angular9-todo-app, so that initializing ng-deploy will set it up to connect to the existing storage account angular9todoappstatic. Make sure that storage account is not owned/accessible by you.

  2. add ng-deploy with ng add @azure/ng-deploy

  3. sign in

  4. (storage account and other dependencies are created automatically)

  5. ✔ Creating resource group {{ResourceGroup}} at West US (westus)
    Account {{StorageAccountName}} already exist on subscription, using existing account
    CREATE azure.json (410 bytes)
    UPDATE angular.json (5475 bytes

  6. Deploy the app with ng deploy

  7. Preparing for deployment
    Error when trying to deploy:
    The Resource 'Microsoft.Storage/{{StorageAccountName}}' under resource group '{{ResourceGroup}}' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

Expected behavior
Either of the following behaviours would be nice:

  1. create a storage account with a unique name, e.g., a UUID so there are no conflicts
  2. To fail clearly at the initialization stage, when ng-deploy is added and the user signs in.

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise

Additional context
N/A

Target did not produce any files, or the path is incorrect.

Describe the bug
I have configured my azure.json file with the correct values according to the AzureJSON interface (using the ng add @azure/ng-deploy command). When I try to run ng run <project-name>:deploy I get told that my path is empty (which it isn't). It then runs my build command and once again complains that my path is empty (which it isn't).

I also noticed that getFiles ignores directories https://github.com/Azure/ng-deploy-azure/blob/master/src/builders/actions/deploy.ts#L121. I have an assets folder in my build directory that should be included in the deployment.

My Angular application has multiple projects (app + libraries), if that bears any relevance.

To Reproduce
Steps to reproduce the behavior:

  1. Create an angular app with projects.
  2. Try to deploy a project.

Expected behavior
ng run <project-name>:deploy should deploy my project compiled in the directory specified in azure.json.hosting[0].app.path.

Screenshots

Screenshot 2019-09-12 at 14 43 34

Desktop (please complete the following information):

  • OS: OSX 10.14.6
  • Browser n/a
  • Version n/a

Add support for Angular CLI v9

Describe the bug
When adding @azure/ng-deploy to an angular project v9, we get the following error:

Cannot read the output path (architect.build.options.outputPath) of project "bazel-angular" in angular.json

To Reproduce
Steps to reproduce the behavior:

  1. npm i -g @angular/cli@9
  2. angular new demo
  3. ng add @azure/ng-deploy
  4. See error

Expected behavior
@azure/ng-deploy should support the new angular v9 builder API.

Screenshots
image

Related issue #85

Add test task to pipeline

Description

This will ensure the build pipeline run unit tests that upon:

  • On Success, creates an artifact that we can use to deploy
  • On Failure, does not create an artifact

This is an update to the Azure DevOps config file

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

Spinner gets stuck after create a resource group

Describe the bug
Call ng add. Resource group is created and spinner gets stuck early on. Having tracked down the issue it's in the checkNameAvailability() function. The function is meant to validate a name and needs to respond true if name is available and false if not. Currently, it gets stuck in a loop of false responses

Suggested code fix is

  return async (account: string) => {
    spinner.start();
    const availability = await client.storageAccounts.checkNameAvailability(account);
    if (!availability.nameAvailable && warn) {
      spinner.fail(availability.message || 'chosen name is not available');
      return false;
    } else {
      spinner.stop();
      return true;
    }
  };
}

Expected behavior
Expect azure.json to be generated

Storage account needs to be unique per subscription

Describe the bug
Account name needs to be unique per subscription

To Reproduce
deploy a quickstart twice and the second time it should complain about account name collision

Expected behavior
should use existing storage account the second time around

Add Greenkeeper.io

Once we have this in azure pipeline, we can add greenkeeper.io to make PRs and test them for npm version and security updates.

Add Telemetry

Description

This is about understanding how users use the product so we can focus on the right parts to add features to/improve

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

feature: extract azure logic into a separate library

Description

Many of the Azure logic used in this tool (like login, subscription selection, resource group selection/creation, etc) could be extracted in a separate library, independant from the Angular schematics/builds.

By doing this, it could help bootstrapping other tools, like a standalone CLI to do the same deployment logic for React/Vue projects.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Deploy Failing in Continuous Integration Mode

Describe the bug
ng-deploy working fine in interactive mode but when i try to deploy in CI mode its failing with

Get Token request returned http error: 400 and server response: {"error":"invalid_request","error_description":"AADSTS900023: Specified tenant identifier ''*********************--''' is neither a valid DNS name, nor a valid external domain

To Reproduce
Steps to reproduce the behavior:

my packages are


"dependencies": {
    "@angular/animations": "8.2.12",
    "@angular/cdk": "~8.2.3",
    "@angular/common": "8.2.12",
    "@angular/compiler": "8.2.12",
    "@angular/core": "8.2.12",
    "@angular/forms": "8.2.12",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "8.2.12",
    "@angular/platform-browser-dynamic": "8.2.12",
    "@angular/platform-server": "8.2.12",
    "@angular/router": "8.2.12", 
    "@azure/ng-deploy": "^0.2.3"
}

and create Service Principal using the Azure CLI, will give you something like this

{
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"displayName": "",
"name": "http://",
"password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

and I'm able to login with

az login --service-principal -u $CLIENT_ID -p $CLIENT_SECRET --tenant $TENANT_ID

But when trying to deploy with ng-deploy with CI = 1 (ng run myapp:deploy)

CI mode detected
Checking for configuration...
Using CLIENT_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
Using CLIENT_SECRET='**********************--**'
Using TENANT_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
Using AZURE_SUBSCRIPTION_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
Configuration OK

Get Token request returned http error: 400 and server response: {"error":"invalid_request","error_description":"AADSTS900023: Specified tenant identifier ''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'' is neither a valid DNS name, nor a valid external domain

Expected behavior

should deploy to CDN same as interactive mode

No longer works for Angular 13

Describe the bug
After upgrading to Angular 13, ng deploy no longer works. I get the following error
An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID"

To Reproduce
Steps to reproduce the behavior:

  1. Generate a new angular using version 13
  2. Add @azure/ng-deploy
  3. Configure
  4. Run ng deploy

Expected behavior
Deploy should be successful

Desktop (please complete the following information):

  • OS: [e.g. iOS] Ubuntu
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22] 0.2.3

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.