Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import-AzureRmApiManagementApi -SpecificationPath doesn't handle relative path #6603

Closed
AbhishekTripathi opened this issue Jul 4, 2018 · 2 comments
Assignees
Labels
API Management Service Attention This issue is responsible by Azure service team.

Comments

@AbhishekTripathi
Copy link

AbhishekTripathi commented Jul 4, 2018

Description

Import-AzureRmApiManagementApi is not mapping the relative path for SpecificationPath to the current working directory. It jumps to the root of the drive.

Script/Steps for Reproduction

$SwaggerFilePath = ".\apim\swagger\apimanager-api-SomeService.json" #CWD is somewhere nested deep in folder hierarchy.
$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $APIMServiceName
Import-AzureRmApiManagementApi -Context $ApiMgmtContext -SpecificationFormat Swagger -SpecificationPath $SwaggerFilePath -Path $APIMEndpointPath

Module Version

Update: I updated AzureRM module to latest version at the time of this comment. I don't see a difference in the debug output.

Get-Module -Name AzureRM -ListAvailable
    Directory: C:\Program Files\WindowsPowerShell\Modules


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.4.0      AzureRM
Script     5.5.0      AzureRM

Environment Data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.15063.1088
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.1088
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Debug Output

Import-AzureRmApiManagementApi : Could not find a part of the path 'D:\apim\swagger\apimanager-api-SomeService.json'.
At line:1 char:1

  • Import-AzureRmApiManagementApi -Context $api_ctxt -SpecificationForma ...
  •   + CategoryInfo          : CloseError: (:) [Import-AzureRmApiManagementApi], DirectoryNotFoundException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.ImportAzureApiManagementApi
    
    

DEBUG: AzureQoSEvent: CommandName - Import-AzureRmApiManagementApi; IsSuccess - False; Duration - 00:00:00.0601188; Exception - System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\apim\swagger\apimanager-api-SomeService.json'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath,
Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Microsoft.Azure.Commands.ApiManagement.ServiceManagement.ApiManagementClient.ApiImportFromFile(PsApiManagementContext context, String apiId, PsApiManagementApiFormat specificationFormat, String specificationPath, String apiPath, String wsdlServiceName,
String wsdlEndpointName, Nullable`1 apiType)
at Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.ImportAzureApiManagementApi.ExecuteApiManagementCmdlet()
at Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands.AzureApiManagementCmdletBase.ExecuteCmdlet();
DEBUG: Finish sending metric.
DEBUG: 3:18:12 PM - ImportAzureApiManagementApi end processing.
DEBUG: 3:18:12 PM - ImportAzureApiManagementApi end processing.


@cormacpayne
Copy link
Member

@solankisamir Hey Samir, would you mind taking a look at this issue?

solankisamir added a commit to solankisamir/azure-powershell that referenced this issue Aug 21, 2018
solankisamir added a commit to solankisamir/azure-powershell that referenced this issue Aug 23, 2018
@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Management Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants