Comments (6)
@timayabi2020 This is not an autorest issue. The root cause if you did not construct the $requestBody correctly. In PowerShell, if you use $xx, it will parse it as a variable whose name is xx. You will need to use something like "`$xx" instead of "$xx".
from autorest.powershell.
@timayabi2020 Would you share more details to reproduce the issue? e.g. swagger, how you guys generate the module with autorest.powershell
from autorest.powershell.
@dolauli below are the steps on how to reproduce this issue
- Install Microsoft.Graph PowerShell SDK from here.
- Connect to Microsoft Graph
Connect-MgGraph -Scope "AccessReview.ReadWrite.All"
. - Switch to Microsoft Graph's beta endpoint
Select-MgProfile "beta"
- Construct the request payload like the one below.
$requestBody = @{ "descriptionForAdmins" = "Review for some pim roles" "descriptionForReviewers" = "Review for some pim roles" "displayName" = "PIM review" "scope" = @{ "query" = "/roleManagement/directory/roleEligibilityScheduleInstances?$expand=principal&$filter=(isof(principal,'microsoft.graph.user') and roleDefinitionId eq '9c6df0f2-1e7c-4dc3-b195-66dfbd24aa8f')" "queryType" = "MicrosoftGraph" "@odata.type" = "#microsoft.graph.accessReviewQueryScope" } "settings" = @{ "defaultDecision" = "Deny" "defaultDecisionEnabled" = $false "instanceDurationInDays" = 25 "justificationRequiredOnApproval" = $true "mailNotificationsEnabled" = $true "recommendationsEnabled" = $true "reminderNotificationsEnabled" = $true "recurrence" = @{ "pattern" = @{ "type" = "absoluteMonthly" "interval" = 3 } "range" = @{ "type" = "noEnd" "startDate" = "2023-06-01" } } } }
- Run the following command with debug
New-MgIdentityGovernanceAccessReviewDefinition -BodyParameter $requestBody -debug
We use pipelines defined on this repository to generate powershell cmdlets from open API files. In this particular case, the open API file responsible is here
from autorest.powershell.
@dolauli Xiaogang Ding FTE below are the steps on how to reproduce this issue
- Install Microsoft.Graph PowerShell SDK from here.
- Connect to Microsoft Graph
Connect-MgGraph -Scope "AccessReview.ReadWrite.All"
.- Switch to Microsoft Graph's beta endpoint
Select-MgProfile "beta"
- Construct the request payload like the one below.
$requestBody = @{ "descriptionForAdmins" = "Review for some pim roles" "descriptionForReviewers" = "Review for some pim roles" "displayName" = "PIM review" "scope" = @{ "query" = "/roleManagement/directory/roleEligibilityScheduleInstances?$expand=principal&$filter=(isof(principal,'microsoft.graph.user') and roleDefinitionId eq '9c6df0f2-1e7c-4dc3-b195-66dfbd24aa8f')" "queryType" = "MicrosoftGraph" "@odata.type" = "#microsoft.graph.accessReviewQueryScope" } "settings" = @{ "defaultDecision" = "Deny" "defaultDecisionEnabled" = $false "instanceDurationInDays" = 25 "justificationRequiredOnApproval" = $true "mailNotificationsEnabled" = $true "recommendationsEnabled" = $true "reminderNotificationsEnabled" = $true "recurrence" = @{ "pattern" = @{ "type" = "absoluteMonthly" "interval" = 3 } "range" = @{ "type" = "noEnd" "startDate" = "2023-06-01" } } } }
- Run the following command with debug
New-MgIdentityGovernanceAccessReviewDefinition -BodyParameter $requestBody -debug
We use pipelines defined on this repository to generate powershell cmdlets from open API files. In this particular case, the open API file responsible is here
@timayabi2020 This is not something I really need. I do not have much time to dive into your project. Would you provide two things for me to reproduce your issue.
- An example swagger (Even no need of a msgraph swagger, just a swagger that could reproduce the issue you mentioned)
- How you guys generate the module based on the swagger.
Here is an example you may follow.
from autorest.powershell.
@dolauli thanks for the clarification and the shared example. Below are the repro steps
Using sample at: https://gist.github.com/timayabi2020/ce733256dab5002ee304d87d4b15642f
autorest --title:"Identity.Governance" autorestConfig.yml --verbose
autorestConfig.yml
powershell: true
version: latest
use: '@autorest/[email protected]' #Replace with '@autorest/[email protected]' for autorest v2
export-properties-for-dict: false
subject-prefix: '-Mg'
azure: false
input-file: "https://gist.githubusercontent.com/timayabi2020/ce733256dab5002ee304d87d4b15642f/raw/d1cc2aae8a47646f32ad9c0ac4448425f9e8a88d/SampleIdentityGovernance.yml"
output-folder: IdentityGovernance\src\$(title)
clear-output-folder: true
use-internal-constructors: true
use-datetimeoffset : true
metadata:
authors: Microsoft Corporation
owners: Microsoft Corporation
companyName: Microsoft Corporation
description: 'Microsoft Graph PowerShell Cmdlets'
copyright: © Microsoft Corporation. All rights reserved.
tags: Microsoft Office365 Graph PowerShell PSModule PSIncludes_Cmdlet
requireLicenseAcceptance: true
licenseUri: https://aka.ms/devservicesagreement
projectUri: https://github.com/microsoftgraph/msgraph-sdk-powershell
iconUri: https://raw.githubusercontent.com/microsoftgraph/g-raph/master/g-raph.png
directive:
- no-inline:
- MicrosoftGraphSharepointIds
- MicrosoftGraphIdentitySet
- MicrosoftGraphItemReference
- MicrosoftGraphDirectoryObject
- MicrosoftGraphUser
- MicrosoftGraphDrive
- MicrosoftGraphListItem
- MicrosoftGraphPost
- MicrosoftGraphSectionGroup
- MicrosoftGraphTeam
- MicrosoftGraphRecipient
- MicrosoftGraphGroupPolicyCategory
- MicrosoftGraphPrinter
- MicrosoftGraphPrinterShare
- MicrosoftGraphGovernanceResource
- MicrosoftGraphGovernanceRoleAssignment
- MicrosoftGraphGovernanceRoleDefinition
- MicrosoftGraphWorkbookOperationError
- MicrosoftGraphParentLabelDetails
- MicrosoftGraphEdiscoveryTag
- MicrosoftGraphEdiscoverySourceCollection
- MicrosoftGraphContentType
- MicrosoftGraphColumnDefinition
- MicrosoftGraphGroupPolicyDefinition
- MicrosoftGraphGroupPolicyDefinitionValue
- MicrosoftGraphSynchronizationLinkedObjects
- MicrosoftGraphSecuritySecurity
- MicrosoftGraphTeamSummary
- MicrosoftGraphSecurityInformationProtection
- MicrosoftGraphSecurityInformationProtectionPolicySetting
- MicrosoftGraphSecuritySensitivityLabel
- MicrosoftGraphTaskViewpoint
- MicrosoftGraphSecurityEdiscoveryReviewTag
- MicrosoftGraphSecurityEdiscoverySearch
- MicrosoftGraphManagedTenantsManagementTemplateStep
- MicrosoftGraphPlannerTaskCreation
- MicrosoftGraphPlannerTeamsPublicationInfo
The below versions (V3 and V2) of autorest have been used.
- @autorest/powershell 3.0.504
- @autorest/powershell 2.1.401
from autorest.powershell.
@dolauli . Thanks alot.
from autorest.powershell.
Related Issues (20)
- [Feature] Add module name in the breaking change message
- Last link in README.md is broken HOT 1
- build module failed because invalid variable generated HOT 5
- Description for the DontShow parameters should provide more info HOT 2
- Add support for preview to ignore for non-azure HOT 2
- Dependency to Azure Commands.Utilities.Common in generated powershell CLI HOT 1
- Create connect function HOT 10
- Optional properties are set when updating other properties HOT 1
- Add support for any type HOT 3
- Struggling to get started creating a PowerShell module (stuck on 'SCHEMA MISSING?')
- Deep
- breaking change warning directive cannot take effect on model cmdlet
- In V4 the generated extended command is missing parameters
- Move some generated files from root folder to subfolder HOT 1
- [Feature] Validate directives
- Need a way to sleep in the test script HOT 3
- Build-module will overwrite updated example files when renaming.
- Media content-type header is not being generated for input file types. HOT 3
- [Autorest] optional parameter is set to be required in VMware swagger
- Module will be created and inited many times in one session when `-Parallel` is used. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autorest.powershell.